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

How can I change this text's text?

Asked by 4 years ago

I have made a game and whenever you click the ring, the quest should change, but nothing happened but the ring got destroyed (which means the script isn't wrong). Is it just a bug or did I do something wrong?

script:

script.Parent.MouseClick:Connect(function(click)
    game.StarterGui.ScreenGui.Frame.QuestInfo.Text = "return the ring"
    script.Parent.Parent.Parent:Destroy()

end)
0
Use a LocalScript and get the gui in the player's PlayerGui. https://developer.roblox.com/en-us/api-reference/class/PlayerGui Spjureeedd 385 — 4y
0
How can I get the gui in the player's PlayerGui? TheKakYTArmy 125 — 4y
0
I seriously sent you a link... Get the LocalPlayer and then the PlayerGui is a child of the player Spjureeedd 385 — 4y
0
Hi, are you using a localscript or serverscript? guest_20I8 266 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

Hi. In the line ' game.StarterGui.ScreenGui.Frame.QuestInfo.Text = "return the ring" ', the QuestInfo belongs to the StarterGui, not the player's gui, you should do this instead:

script.Parent.MouseClick:Connect(function(Player) -- It's the player that clicked
    Player.PlayerGui.ScreenGui.Frame.QuestInfo.Text = "return the ring"
    script.Parent.Parent.Parent:Destroy()
end)
Ad
Log in to vote
-1
Answered by 4 years ago

You need to use a Remote Event

Answer this question