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

Why is my local script not running locally ?

Hello! I created a local script for checkpoints, but for some reason it does not work locally. What could be the problem?


local player= game:WaitForChild("Players").LocalPlayer
local character = player.Character
local CheckpointData = script.CheckpointData
local CheckpointValue =  script.CheckpointData.CheckpointValue


for i, v in pairs(game.Workspace.CheckpointFolder:GetChildren()) do
	if v:IsA("Part") then
		
  function onTouch()
	CheckpointValue.Value=v.Position
end

	v.Touched:connect(onTouch)
	end
end
	
for i, v in pairs(game.Workspace.Obby.KillPart:GetChildren()) do
	if v.Name == "KillPart" then
        function onTouch()
				player.Character:MoveTo(CheckpointValue.Value)
				game.ReplicatedStorage.Death:FireServer(player)
			end
		end
	end

	v.Touched:connect(onTouch)
end

1 answer

Remove the first line. FindFirstChild checks parts, folders, etc. You are checking a string value. To do that, you'd do

repeat
until not game.Players.LocalPlayer == nil

Its also not needed, as client scripts run when there is a client

1 comment

0

You need to add a task.wait() to this otherwise you will probably time out.

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