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

Simple script fix about touching a part, can anyone see what I need to change?

Asked by 6 years ago
Edited 6 years ago

About this script: If someone touches this part then a GUI will pop up(visible = true), but in this case in doesn't pop up. Can anyone please help? Thanks!

workspace.mayorTrigger.Touched:connect(function()
    print ("touched")
    script.Parent.Parent.Parent.StarterGui.buttonInteract.buttonFrameMayor.Visible = true
end)

1 answer

Log in to vote
0
Answered by
k1nq 30
6 years ago

The script for onTouched shouldn't be in a LocalScript. Instead you should put a script in a part and make the line something such as :

script.Parent.Touched:connect(function(Hit)
    local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
    if Player then
        Player.PlayerGui.buttonInteract.buttonFrameMayor.Visislbe = true
    end
end)
0
I put that in a regular script under my part with this code with a few changes and nothing worked Mohawkid14 28 — 6y
0
Thanks for helping though! Mohawkid14 28 — 6y
Ad

Answer this question