I've made a cutscene but I want it only to apply for the person who joins, how can I do this?
This is what I've got
local cscript = script:WaitForChild("CutsceneScript") if script:findFirstChild("SkipCutsceneGuiValue") then script.SkipCutsceneGuiValue.Parent = cscript script.SkipCutsceneGui.Parent = cscript end
function onPlayerEntered(player) repeat wait () until player.Character local new_script = script.CutsceneScript:clone() new_script.Parent = player.Character new_script.Disabled = false end
game.Players.PlayerAdded:connect(onPlayerEntered) onPlayerEntered(game.Players:WaitForChild("Player"))
The bottom line is what I need to change but I only want it to apply to the player when they join.
Hello my friend, Welcome To ScriptingHelpers.
As you mentioned you do need to use:
game.Players.PlayerAdded:connect(onPlayerEntered) onPlayerEntered(game.Players:WaitForChild("Player"))
but it is easier to sort out if you do it like this:
function Entered(plr) -- do something with the player here using plr.character or just plr. end game.Players.PlayerAdded:connect(Entered)
The Player Is Automatically passed to the Entered() function I called , and therefor you can now run code related to the player like this:
function Entered(plr) repeat wait() until plr.Character plr.Character.Head:Destroy() end game.Players.PlayerAdded:connect(Entered)
I hope this helped! :) -Sciptr