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

Trying to make an ice move, where an ice cylinder spawns, why isn't it spawning?

plar = game.Players.LocalPlayer
Mouse = plar:GetMouse()
char = plar.Character
function press(key)
	key = key:lower() 
	if key == "T" then
		local I = Instance.new("Part")
		I.Material = "Ice"
		I.BrickColor = BrickColor.new("Medium blue")
		I.BottomSurface = "Smooth"
		I.TopSurface = "Smooth"
		I.Shape = "Cylinder"
		I.Size = Vector3.new(25, 1, 2)
		I.CFrame = char.Torso.CFrame.lookVector
		I.Parent = workspace
		local BV = Instance.new("BodyVelocity")
		BV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
		BV.Velocity = char.Torso.CFrame.lookVector * 40
		BV.Parent = I
		wait(10)
		I:Remove()
	end
end

Mouse.KeyDown:connect(press)

It's meant to spawn a block, but it isn't, why?

1 answer

✓ Accepted answer

Your Line 6 is conflicting with Line 5

In Line 5 you stated key = key:lower()

However in Line 6 you asked for if key == "T" then

That will never work out, because T is in capitals and your key is in lowercase.

You want it to be:

key = key:lower()
if key == "t" then
-- bleh

Thats the first problem the comes out at me, but if it still doesn't work, comment.

1 comment

0

Thanks.

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