i have a gui that is supposed to give me an item called good build which is in ReplicatedStorage. Can you point out whats wrong here? I looked, and couldn't find anything.
local screenGui = Instance.new("ScreenGui") screenGui.Parent = script.Parent local textButton = Instance.new("TextButton") textButton.Parent = screenGui textButton.Position = UDim2.new(0, 300, 0, 650) textButton.Size = UDim2.new(0, 150, 0, 100) textButton.BackgroundColor3 = BrickColor.White().Color textButton.Style = 3 textButton.Text = "builder" textButton.MouseButton1Down:connect(function() end) if not game.Players.LocalPlayer.Backpack:FindFirstChild("good build") then print("Giving "..game.Players.LocalPlayer.Name.." the builder.") good = game.ReplicatedStorage:FindFirstChild("good build"):Clone() good = good_build.Parent = game.Players.LocalPlayer.Backpack elseif game.Players.LocalPlayer:FindFirstChild("good build") then print(game.Players.LocalPlayer.Name.." You dont need it.") end
Your issue is that when a player clicks the Gui, your function works fine but you don't have anything for it to do!
Debugging
Make sure to debug and read through your scripts, as for yourself you simply misplaced the end)
just with a bit of care and time you should've noticed it. If nothing shows on the output then go through the script line by line. I tend to add print("1")
, print("2")
and so on, so I know where my script is breaking.
Also rather than doing game.ReplicatedStorage
, I suggest doing:
local game:GetService("Replicated Storage")
Conclusion
local game:GetService("Replicated Storage") local screenGui = Instance.new("ScreenGui") screenGui.Parent = script.Parent local textButton = Instance.new("TextButton") textButton.Parent = screenGui textButton.Position = UDim2.new(0, 300, 0, 650) textButton.Size = UDim2.new(0, 150, 0, 100) textButton.BackgroundColor3 = BrickColor.White().Color textButton.Style = 3 textButton.Text = "builder" textButton.MouseButton1Down:connect(function() if not game.Players.LocalPlayer.Backpack:FindFirstChild("good build") then print("Giving "..game.Players.LocalPlayer.Name.." the builder.") good = ReplicatedStorage:FindFirstChild("good build"):Clone() good = good_build.Parent = game.Players.LocalPlayer.Backpack elseif game.Players.LocalPlayer:FindFirstChild("good build") then print(game.Players.LocalPlayer.Name.." You dont need it.") end end)