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

How come the print() is printing but Instance.new() isn't creating a new part?

##=PROBLEM=## So I'm trying to make this magic kind of game and I created a local script inside *StarterCharacterScripts* but when I tested it everything printed but the part isn't being created.

##=My Script/Code=## Here;

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local characterLL = plr.CharacterAdded:Wait():WaitForChild('Left Leg')

mouse.KeyDown:Connect(function(K)
	if K == 'z' then
		local NewIce = Instance.new("Part")
		NewIce.Size = Vector3.new(10,0.2,10)
		NewIce.Name = 'Ice'
		NewIce.Anchored = true
		NewIce.CanCollide = false
		NewIce.Material = 'Ice'
		NewIce.BrickColor = BrickColor.new('Pastel light blue')
		NewIce.TopSurface = 'Smooth'
		NewIce.BottomSurface = 'Smooth'
		NewIce.Position = Vector3.new(characterLL.Position)
		print("complete")
	end
end)

So basically it printed complete but I can't see the NewIce, what's my problem? How can I fix it? Any feedback/help is appreciated. Thanks

2 comments

0

Try parenting in to the workspace and test, checking if the part is actually created. If so, the position is incorrect.

1

You forgot to parent the object. XP

1 answer

✓ Accepted answer

As others have said, you have not parented your new Instance. Without knowing it's parent, it won't where to go (sort of true to real life lol).

So basically just do

NewIce.Parent = something
-- replace something with the directory to what you want the parent to be, which i asume is game.workspace

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