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

Why is my local script not running locally ?

Asked by 2 years ago

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

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

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

0
You need to add a task.wait() to this otherwise you will probably time out. kodymarcey 49 — 2y
Ad

Answer this question