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

What is wrong with this script

Asked by 10 years ago

i want to make a GUI button that becomes visible when a button in workspace is touched by you. I wrote this script and it doesn't work!

function onTouched (part)
    game.StarterGui.GUIMessage.Message.Visible = true
end
script.Parent.Touch:connect(onTouched)

that script is in the part that needs to be touched the button that i want to be made visible is called message

if this is inpossible can you tell me how to make a script that makes a new instance of a screen GUI and button GUI (with certain position size and text) by stepping on a part

1 answer

Log in to vote
3
Answered by
Azarth 3141 Moderation Voter Community Moderator
10 years ago

The event is Touched, not Touch. Also, changing something in StarterGui will only affect newly received GUI's and not the one the player has.


script.Parent.Touched:connect(function(hit) if hit.Parent and hit.Parent:findFirstChild("Humanoid") then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr and plr.PlayerGui:findFirstChild("GUIMessage") then plr.PlayerGui.GUIMessage.Message.Visible = true end end end)
0
thanks so much it worked SirKitten2000 0 — 10y
0
SirKitten, please mark this as the answer if it is correct. Freemium 110 — 10y
Ad

Answer this question