Why does this script to toggle PlatformStand not work?

Hello, my sibling is working on a marble riding game and needs help with a script that restores the player at the end of the run.

Here is the script:

script.Parent.Touched:Connect(function(hit)
	if hit.Name == "Ball" then
		hit.Parent:FindFirstChild("Humanoid").PlatformStand = false
		hit.Parent:FindFirstChild("UpperTorso").BallWeld:Destroy()
		hit:Destroy()
	end
end)

The object ‘BallWeld’ is destroyed successfully, and so is the ‘hit’ object.
Here is the video of the problem: (PlatformStand’s value is not changed)
Video

Is the script located in the ball?
And is the ball welded towards the player?

The script is located in a part in workspace and the ball is welded to the player with BallWeld (which is parented to UpperTorso)

the ball’s parent is the player

So the ball’s parent is the Player Instance? Or the character.

Can you show us the output?
(limit)

nothing is output, the ball is parented to the character in the workspace

script.Parent.Touched:Connect(function(hit)
	if hit.Name == "Ball" and hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("UpperTorso") then
		hit.Parent:FindFirstChild("Humanoid").PlatformStand = false
		hit.Parent:FindFirstChild("UpperTorso").BallWeld:Destroy()
		hit:Destroy()
	end
end)

Should work

Maybe it was erroring without your knowledge, yielding the rest of the script.

No luck! Still doesn’t work 123123

Odd.

Can you send me the game file so I can try and troubleshoot it?

It’s fine if you don’t want to.

Hey, we got it fixed, they had ‘PlatformStand = true’ in a ‘while true do’ loop on the spawner

Yes, that would be an issue haha!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.