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

My touched script wont enable another script when the part is touched?

Asked by 6 years ago
Edited 6 years ago

So, I feel kind of embarrassed for not knowing how to fix this or how to even do it correctly in the first place, but what I'm trying to do is make a script enabled when the player touches a part. This is in a local script.

local plr = game.Players.LocalPlayer
local name = plr.Name

script.Parent.Touched:Connect(function(hit)
    if hit.Parent.Name == name then
        plr.PlayerGui.ArmorShopOwner.Frame.TextLabel.NPCTalk.Disabled = false
    end
end)
0
Where is this local script located? KingLoneCat 2642 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Local Scripts don't work in the Workspace. You'll have to put it under StarterPlayer > StarterPlayerScripts. Here's a modified version of your script

local plr = game.Players.LocalPlayer
local name = plr.Name
game.Workspace."PUT YOUR PART'S LOCATION HERE".Touched:Connect(function(hit)
    if hit.Parent.Name == name then
        plr.PlayerGui.ArmorShopOwner.Frame.TextLabel.NPCTalk.Disabled = false
    end
end)

Please accept as an answer if it works :) If you have any trouble just leave a comment and I'll do my best to further help.

0
Thank you. First time I got everything I needed from an answer. Conquesias 85 — 6y
Ad

Answer this question