Script:


function make(pos)
	local g = Instance.new("Part")
	g.Parent = workspace
	g.BrickColor = BrickColor.new("Cork")
	g.Size = Vector3.new(4,4,4)
	g.CFrame = pos
end
script.Parent.Parent.Activated:Connect(function()
	local mouse = game.Players:GetPlayerFromCharacter(script.Parent.Parent.Parent):GetMouse()
	
	make(mouse.Hit)	
	
	
	
	
end)

The problem is that every time this script runs on line 11 it causes an index nil for some reason. How do I fix this?

5 comments

0

this is a normal script not local btw

0

Where is this script placed

0

startergui

0

I'd recommend using remote events for this.

0

god i learned how to use remote events and learned that hit is cframe