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

Works in studio, but not in-game, help?

function kill(part)
	local h = part.Parent:findFirstChild("Humanoid")
	if h then
		wait(.1)
		h.WalkSpeed = 0
		local a = Instance.new("Part")
		a.Parent = game.Workspace
		a.CFrame = h.Parent.Torso.CFrame+Vector3.new(0,1,0)
		a.CanCollide = false
		a.Size = Vector3.new(5,7,5)
		a.Anchored = true
		a.BrickColor = BrickColor.Blue()
		a.Transparency = .5
		a.Reflectance = .5
		a.TopSurface = "Smooth"
		a.BottomSurface = "Smooth"
		game.Players.LocalPlayer.Character.Humanoid.Changed:connect(function(jumpy) if jumpy == "Jump" then game.Players.LocalPlayer.Character.Humanoid.Jump = false end end
		)h.Parent.Torso.Anchored = false
		for i = 1,110 do
			wait()
			h.Health = h.Health - 1
			h.Parent.Health.Disabled = true
		end
		if h.Health == 0 then
			wait(5)
			a:Destroy()
		end
	end
end

script.Parent.Touched:connect(kill)

When you touch it, it is supposed to insert a new part, that looks like ice and slowly kill you. It does everything in-game just not the killing part, which means the player can not move until he/she resets. Help? Also when you die, it inserts new parts... how do I prevent that from happening?

1 comment

0

I made it a local script, but it now doesn't work at all

3 answers

✓ Accepted answer

If you're not already, make sure this is in a LocalScript, it's accessing the LocalPlayer.

Pretty much what he teamkilled said; In studio you are both Client and Server, unlike in-game.

Replace game.Players.LocalPlayer.Character.Humanoid with h.

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