Well I am not getting any errors. When the part spawns the BodyPosition goes to 0, 0, 0 for some reason. The topos is defined, I have already tried printing it. The BodyPosition is also working because if I were to move the part upwards it would glide right back down. Any solutions? Around lines 13-17 is where I think the problem is.
local serverstorage = game:GetService("ServerStorage") function clone(player, part, position, topos) local magics = serverstorage.magicstuff local thing = magics:FindFirstChild(part) local magics2 = magics:GetChildren() for _, stuff in pairs(magics2) do if stuff.Name == part then thing = stuff end end if thing ~= nil then local parts = thing:Clone() parts.Parent = game.Workspace parts.Position = Vector3.new(position) local bp = parts.BodyPosition bp.position = Vector3.new(topos) else print 'A part is not in magicstuff' end end script.Parent.OnServerEvent:connect(clone)
Actually, the property names are CASE SENSITIVE, so in line 17, it should be Position
instead of position
.
Let me fix your script:
local serverstorage = game:GetService("ServerStorage") function clone(player, part, position, topos) local magics = serverstorage.magicstuff local thing = magics:FindFirstChild(part) local magics2 = magics:GetChildren() for _, stuff in pairs(magics2) do if stuff.Name == part then thing = stuff end end if thing ~= nil then local parts = thing:Clone() parts.Parent = game.Workspace parts.Position = Vector3.new(position) local bp = parts.BodyPosition bp.Position = Vector3.new(topos) -- HERE!!!! else print 'A part is not in magicstuff' end end script.Parent.OnServerEvent:Connect(clone) -- Also, use :Connect() instead of :connect() now!
If you have any questions, please leave a comment below! Thanks and I hope this will help!
Couldn't figure out how to edit my question, but this is the other script.
local player = game.Players.LocalPlayer local mouse = player:GetMouse() function equiped() local plrgui = player.PlayerGui plrgui.SpellGui.SpellFrame.Visible = true end function unequiped() local plrgui = player.PlayerGui plrgui:WaitForChild("SpellGui").SpellFrame.Visible = false end function isequip() if script.Parent.Parent.Parent.ClassName == "Model" then return true else return false end end function change() if script.Parent.Parent.Parent.ClassName == "Model" then equiped() else unequiped() end end script.Parent.Parent.Changed:connect(change) function mouseclick() local plrgui = player.PlayerGui local hit = mouse.Hit if isequip() == true then if plrgui.SpellGui.spelltype.Value == "Fire" then local magic = script.Parent.Parent.Shoot --magic.Position = Vector3.new(script.Parent.Parent.Shoot.Position) --local bg = script.BodyGyro:Clone() --local bp = script.BodyPosition:Clone() local topos = mouse.Hit.p --bg.Parent = magic --bp.Parent = magic --bp.Position = Vector3.new(hit.p) game.Workspace.Events.Cloning:FireServer("Shootf", script.Parent.Parent.Shoot.Position, topos) end end end mouse.Button1Down:connect(mouseclick)