Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can anyone explain why it wont print working if the item is there?

Asked by 6 years ago
Edited 6 years ago

local textb = game.StarterGui.ScreenGui.TextButton

textb.MouseButton1Click:connect(function(e) if game.Players.LocalPlayer.Backpack.Item then

print("Working.")

end

end)


StarterGUI

ScreenGUI

TextButton

Script

That how it goes

0
Are you sure you're using a local script? GoldenCosmo 64 — 6y
0
Yes, I'm sure and plus your answer didn't work at all. GloBoySo300 0 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Change

local textb = game.StarterGui.ScreenGui.TextButton

to

local textb = script.Parent

also, to make sure that your script doesn't return error, change

if game.Players.LocalPlayer.Backpack.Item then

to

if game.Players.LocalPlayer.Backpack:FindFirstChild("Item") then

also make sure that you are using LocalScript

0
I don't have it script.parent because there's another script GloBoySo300 0 — 6y
Ad

Answer this question