So i'm trying to make a tree spawn at the place I click at and it works but it doesn't 100% work heres what happens http://i.gyazo.com/5fe1460494e84a39c526d51ac76106a1.png
The error http://gyazo.com/332065e0b8188fabf70df1ee0f3b0377
-- the code local mouse = plugin:GetMouse() mouse.Button1Down:connect(function() local NewPart = Instance.new("Part") NewPart.Anchored = true NewPart.Parent = game.Workspace local Mesh = Instance.new("SpecialMesh", NewPart) Mesh.MeshId = "http://www.roblox.com/asset/?id=150251147" Mesh.Scale = Vector3.new(3.1, 3.1, 3.1) Mesh.TextureId = "http://www.roblox.com/asset/?id=150251554" NewPart.Size = Vector3.new(2, 3, 31.6) local target = mouse.Target NewPart.Position = target -- where the error is happening end)
mouse.Target
will return a userdata
(instance), so you need to index the Position
property of target
.
local mouse = plugin:GetMouse() mouse.Button1Down:connect(function() local NewPart = Instance.new("Part") NewPart.Anchored = true NewPart.Parent = workspace local Mesh = Instance.new("SpecialMesh", NewPart) Mesh.MeshId = "http://www.roblox.com/asset/?id=150251147" Mesh.Scale = Vector3.new(3.1, 3.1, 3.1) Mesh.TextureId = "http://www.roblox.com/asset/?id=150251554" NewPart.Size = Vector3.new(2, 3, 31.6) local target = mouse.Target NewPart.Position = target.Position end)