Mouse.Hit.p Doesn't work with TweenService?
Asked by
5 years ago Edited 5 years ago
So i was making a fireball script for cool stuff( using remote )
LocalScript:
01 | local FireBall = game.Workspace.FireBall |
02 | local rp = game:GetService( "ReplicatedStorage" ) |
03 | local FireBallRemote = rp.RemoteEvents.FireBall |
04 | local UIS = game:GetService( "UserInputService" ) |
05 | local player = game.Players.LocalPlayer |
06 | local mousehit = player:GetMouse().Hit.p |
08 | UIS.InputBegan:Connect( function (input, IsTyping) |
12 | elseif input.KeyCode = = Enum.KeyCode.E then |
13 | FireBallRemote:FireServer(player, mousehit) |
ServerScript:
01 | local FireBall = game.Workspace.FireBall:Clone() |
02 | local rp = game:GetService( "ReplicatedStorage" ) |
03 | local FireBallRemote = rp.RemoteEvents.FireBall |
04 | local UIS = game:GetService( "UserInputService" ) |
05 | local TweenService = game:GetService( "TweenService" ) |
07 | FireBallRemote.OnServerEvent:Connect( function (player, mousehit) |
08 | local Character = player.Character |
09 | local HumanoidRootPart = Character.HumanoidRootPart |
10 | local Align = Instance.new( "AlignPosition" ) |
12 | Align.Parent = HumanoidRootPart |
13 | Align.Attachment 0 = HumanoidRootPart.RootRigAttachment |
14 | Align.Attachment 1 = FireBall.FireBallAttachment |
15 | Align.RigidityEnabled = true |
16 | FireBall.Parent = Character |
17 | FireBall.CFrame = HumanoidRootPart.CFrame * CFrame.new( 0 , 45 , 0 ) |
20 | info 1. Size = FireBall.Size + Vector 3. new( 30 , 30 , 30 ) |
21 | local info 12 = TweenInfo.new( 7 , Enum.EasingStyle.Quad) |
22 | local tween 2 = TweenService:Create(FireBall,info 12 , info 1 ) |
28 | info.CFrame = mousehit |
29 | local info 6 = TweenInfo.new( 7 ,Enum.EasingStyle.Quint ) |
30 | local tween 1 = TweenService:Create(FireBall, info 6 , info) |
As you can see there i was trying to set the CFrame value of the tween to the Mouse.p
I checked and clicked "E" This is what the Output said D:,
Output:
** 18:08:26.645 - TweenService:Create property named 'CFrame' cannot be tweened due to type mismatch (property is a 'CoordinateFrame', but given type is 'Instance')
18:08:26.661 - Script 'ServerScriptService.FireBallHandle', Line 30**
what is that event suppose to mean, if you have any ideas how to set the fireball tween movement (CFrame) to the Cursor's aim or how to fix this , please tell me
(I've tried oCrxptic Solution but that reach's on the output to : ->Unable to cast to Dictionary <-