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

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

Asked by 5 years ago

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

Log in to vote
0
Answered by
0b1w 13
5 years ago
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.

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 SaitamaSaan 9 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
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 :)

Answer this question