I try to move a Rock (Part) in FRONT of the player when he fired the server and I want to keep this Part at the same HEIGHT as the floor when I move it (I don't want the part to stay in the air when I move it). Here is my problem !
plr = game:GetService("Players").LocalPlayer game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr,location) local Rock = game.workspace.Rock local RockAttack = Rock:Clone() RockAttack.Parent = game.Workspace RockAttack.Anchored = true RockAttack.Position=Vector3.new(plr.Character.HumanoidRootPart.CFrame.x,0,plr.Character.HumanoidRootPart.CFrame.z) * location -----------------> The location is (CFrame.new(0,0,-10)) with that I try to move the part in front of the player RockAttack.Orientation = Vector3.new(0,0,90) end)
plr = game:GetService("Players").LocalPlayer game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr,location) local Rock = game.workspace.Rock local RockAttack = Rock:Clone() RockAttack.Parent = game.Workspace RockAttack.Anchored = true RockAttack.CFrame = plr.Character.HumanoidRootPart.CFrame * CFrame.new(0,-x,0) + plr.Character.HumanoidRootPart.CFrame.LookVectir * 4 RockAttack.Orientation = Vector3.new(0,0,90) end)
This should do it.
plr = game:GetService("Players").LocalPlayer game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr,location) local Rock = game.workspace.Rock local RockAttack = Rock:Clone() RockAttack.Parent = game.Workspace RockAttack.Anchored = true RockAttack.Position = Vector3.new(plr.Character.HumanoidRootPart.CFrame.x,0,plr.Character.HumanoidRootPart.CFrame.z) + plr.Character.HumanoidRootPart.CFrame.LookVector * 4 RockAttack.Orientation = Vector3.new(0,0,90) end)
Thanks Oblw I found it because of you :)