Positioning model to mouse position not working?
I made an explosive tool in Roblox and I'm trying to make it clone a Model that gets sent to the mouse position, but whenever I activate the tool, this happens:
15:16:17.028 - Unable to cast Instance to CoordinateFrame
This is my code:
Client:
01 | local Player = game.Players.LocalPlayer |
02 | repeat wait() until Player.Character |
03 | local mouse = Player:GetMouse() |
04 | local Character = Player.Character |
06 | local Humanoid = Character:FindFirstChild( "Humanoid" , true ) |
08 | local Animation = Humanoid:LoadAnimation(script.Animation) |
09 | script.Parent.Equipped:Connect( function () |
11 | Animation:AdjustSpeed( 0.25 ) |
13 | Animation:AdjustSpeed( 0 ) |
15 | script.Parent.Unequipped:Connect( function () |
18 | script.Parent.Activated:Connect( function () |
21 | script.Parent.Activated:Connect( function () |
22 | local position = mouse.Hit.p |
23 | script.Parent.BombDropped:FireServer(position) |
Server:
1 | local bomb = script.Parent.Bomb |
2 | bomb.Parent = game.ServerStorage |
3 | script.Parent.BombDropped.OnServerEvent:Connect( function (position) |
5 | local created = bomb:Clone() |
6 | created.Parent = workspace |
7 | created:SetPrimaryPartCFrame(position) |