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

Obby Checkpoint script whis is supposed to make a gui appear not works!?

Ok so I have a obby with checkpoints and when you step on checkpoints your Stage leaderstats go up by 1 and when you die you spawn at the checkpoint but I made it when you step on it a text label appears and says Checkpoint reached! but its not working and they are 2 seperate scripts but the local scripts not working heres the script Script:

local plr = game.Players.LocalPlayer

local brick = script.Parent

brick.Touched:Connect(function(hum)
	hum = hum.Parent:FindFirstChild("Humanoid")
	if hum then
		plr.PlayerGui.Checkpoint.CheckpointText.Visible = true
		wait(3)
		plr.PlayerGui.Checkpoint.CheckpointText.Visible = false
	end
end)

1 answer

✓ Accepted answer

You shouldn't have it in a localscript. Instead you should use :GetPlayerFromCharacter()

This would be the server script in the block:

local brick = script.Parent

brick.Touched:Connect(function(hit)
    local hum = hit.Parent:FindFirstChild("Humanoid")
    local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
    if hum then
        plr.PlayerGui.Checkpoint.CheckpointText.Visible = true
        wait(3)
        plr.PlayerGui.Checkpoint.CheckpointText.Visible = false
    end
end)

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