Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Positioning model to mouse position not working?

Asked by 4 years ago

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:

01local Player = game.Players.LocalPlayer
02repeat wait() until Player.Character
03local mouse = Player:GetMouse()
04local Character = Player.Character
05wait(0.3)
06local Humanoid = Character:FindFirstChild("Humanoid", true)
07 
08local Animation = Humanoid:LoadAnimation(script.Animation)
09script.Parent.Equipped:Connect(function()
10    Animation:Play()
11    Animation:AdjustSpeed(0.25)
12    wait(0.30)
13    Animation:AdjustSpeed(0)
14end)
15script.Parent.Unequipped:Connect(function()
View all 24 lines...

Server:

1local bomb = script.Parent.Bomb
2bomb.Parent = game.ServerStorage
3script.Parent.BombDropped.OnServerEvent:Connect(function(position)
4    print(position)
5    local created = bomb:Clone()
6    created.Parent = workspace
7    created:SetPrimaryPartCFrame(position)
8end)

Answer this question