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

Why my finish line script is not working? [closed]

Asked by 5 years ago
Edited 5 years ago

This is my script.

script.Parent.Touched:connect(function(hit) if hit ~= nil then if hit.Parent ~= nil then if hit.Parent.Humanoid.Health ~= 0 then local player = game.Players:GetPlayerFromCharacter(hit.Parent) player.Settings.Win.Value = true local spawns = game.Workspace.Lobby.Spawns:GetChildren() hit.Parent.HumanoidRootPart.CFrame = spawns[math.random1,#spawns)].CFrame + Vector3.new(0,3,0) end end end end

This is my Explaination

script.Parent.Touched:connect(function(hit) --------An event that will be fired if the part has been touched if hit ~= nil then --------- if someone touches the finish line if hit.Parent ~= nil then -----------if someone who touches the finish line has a parent if hit.Parent.Humanoid.Health ~= 0 then ----------- if someone who touched it is alive local player = game.Players:GetPlayerFromCharacter(hit.Parent) -----------A variable used for getting the player from someone who touched the finish line player.Settings.Win.Value = true -----------We will set the Setting of the Player to true local spawns = game.Workspace.Lobby.Spawns:GetChildren() -----------A variable used for getting all children of the model spawn from the model lobby hit.Parent.HumanoidRootPart.CFrame = spawns[math.random(1,#spawns)].CFrame +Vector3.new(0,3,0) -----------We will teleport the player who touched the finish line to a random spawn in the lobby.

When I test the minigame LJ, I see in my output that the "Humaniod is member of the Model"

This is my Explorer(In Workspace Only)

Workspace Terrain Camera DataScript Lava Jumps Lava Lava Part Script Lava Part Script Lava Part Script Lava Part Script Lava Part Script Lava Part Script Lava Part Script Lava Part Script Lava Part Script Barrier Barrier Barrier Barrier Finish Line Script
Lobby Part Part Part Part Part Part Part Part Part Part Part Spawns Spawns Spawns Spawns Spawns Spawns Players(InGameTesting) Settings Win Playing Afk

0
nice title bypass Gey4Jesus69 2705 — 5y
0
LOL WideSteal321 773 — 5y
0
nice specific title GoldAngelInDisguise 297 — 5y

Closed as Non-Descriptive by TheeDeathCaster

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?