Hey ich Programmiere zurzeit ein Roblox Simulator und bin dabei einen Shop für Items zu machen (GUI) es funktioniert alles gut außer dass wenn ich mir das Standard Schwert nehme (Bisherr das einzigste) Die Swings nicht sellen kann und es anderen Spielern nicht angezeigt werden(Meine Swings) Es funktioniert mit Dem Selbem Schwert im StarterPack , aber nicht wenn ich über ReplicatedStorage zugreifen möchte (Mit einem LocalScript funktionierts im ReplicatedStorage nur dann wird es den Mitspielern nicht angezeigt) Code :
Script fürs Schwert was ich aus dem Shop holen möchte:
local db = false
local tool = script.Parent
repeat wait() until tool.Parent.Parent:IsA("Player")
local plr = tool.Parent.Parent
local character = plr.Character
tool.Activated:Connect(function()
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, 9443776) then if not db then plr.leaderstats.Swings.Value = plr.leaderstats.Swings.Value + 1
db = true wait(0.250) db = false end else if not db then plr.leaderstats.Swings.Value = plr.leaderstats.Swings.Value + 1
db = true wait(0.500) db = false end end end)
local Part = game.Workspace.Sell Part.Touched:Connect(function(hit) local H = hit.Parent:FindFirstChild("Humanoid") if H then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then local leaderstats = player:WaitForChild("leaderstats") local Currency = leaderstats.Gold local Selling = leaderstats.Swings if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 9398856) then
if Selling.Value > 0 then
Currency.Value = Currency.Value + Selling.Value *2
Selling.Value = 0
end
else
if Selling.Value > 0 then
Currency.Value = Currency.Value + Selling.Value *1
Selling.Value = 0
end
end
end
end
end)
Standart Schwert im StarterPack:
local db = false
local tool = script.Parent
repeat wait() until tool.Parent.Parent:IsA("Player")
local plr = tool.Parent.Parent
local character = plr.Character
tool.Activated:Connect(function()
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, 9443776) then if not db then plr.leaderstats.Swings.Value = plr.leaderstats.Swings.Value + 1
db = true wait(0.250) db = false end else if not db then plr.leaderstats.Swings.Value = plr.leaderstats.Swings.Value + 1
db = true wait(0.500) db = false end end end)
local Part = game.Workspace.Sell Part.Touched:Connect(function(hit) local H = hit.Parent:FindFirstChild("Humanoid") if H then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then local leaderstats = player:WaitForChild("leaderstats") local Currency = leaderstats.Gold local Selling = leaderstats.Swings if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 9398856) then
if Selling.Value > 0 then
Currency.Value = Currency.Value + Selling.Value 2 Selling.Value = 0 end else if Selling.Value > 0 then Currency.Value = Currency.Value + Selling.Value 1 Selling.Value = 0 end end end end end)
Das Letzte Script kommt in hier drunter