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

How can I make it so that once a script runs for a player only once ?

What im trying to do is a player touches a brick and a cutscene plays. But after it play I dont want it to play for the player again. But if someone else touches it I want it to play. I have no clue on how to do this so I have no script to go off of.

4 comments

0

What are you trying to do?

0

I think you should move the script to StarterPlayerScripts :V

0

What im trying to do is a player touches a brick and a cutscene plays. But after it play I dont want it to play for the player again. But if someone else touches it I want it to play.

0

You mean functions, Just call the function ex. brick.touched:connect(FunctionName). You could make the whole script into a function just put that part last and Start with the first line with function ex. FunctionName() --Enter Script-- end brick.touched:connect(FunctionName())

1 answer

✓ Accepted answer

Basically you do this... (If stuff looks strange in this script, click the "raw" button above this code if there is more code)

local HasTouched = Instance.new("IntValue", game:GetService("Players").LocalPlayer)
HasTouched.Value = 0
function cutscene()
	if HasTouched.Value == 0 then

		--cutscene script here




		HasTouched.Value = 1
	end
end


paste your cutscene script under if HasTouched.Value == 0 then and above HasTouched.Value = 1

That should work..

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