Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

1 comment

0

Where is this local script located?

1 answer

✓ Accepted answer

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.

1 comment

0

Thank you. First time I got everything I needed from an answer.

This discussion is preserved as it was. New answers, comments, and votes are closed.