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

How can I make a player script diabled until they touch the ring?

Asked by 6 years ago

I have a punch script put I want it to be disabled until you touch the ring and the script I wrote won't work. Any idea how I can do this?

script.Parent.Touched:connect(function() game.Players.LocalPlayer.PlayerScripts.Left_Punch_Local.Disabled = false game.Players.LocalPlayer.PlayerScripts.Right_Punch_Local.Disabled = false end)

2 answers

Log in to vote
0
Answered by 6 years ago
local touchPart = workspace.Part

local scripts = {workspace.Script1, workspace.Script2}

touchPart.Touched:Wait() --Will wait for the part to be touched


for _,cscript in pairs(scripts) do 

cscript.Disabled = false

end

This will only execute once, if you want it to execute several times you do

touchPart.Touched:Connect(function()
--continue code here..
end)
0
doesn't work YogamingHenshaw 19 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

Can't you just put the whole script into an If statement that fires off on touch?

Answer this question