Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

attempt to multiply a Vector3 with an incompatible value type or nil?

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)

2 answers

✓ Accepted answer
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.

1 comment

0

OMG thank you very much, it's not what I wanted, but thanks to you I managed to find what I miss. that's what I'm getting

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 :)

This discussion is preserved as it was. New answers, comments, and votes are closed.