Hey! I was messing around with prop spawning when I noticed that each time I click, the prop spawns fine but it spawns at my old HRP LookVector position until I click again, then it spawns at my current HRP LookVector position.
Here’s a video to help you understand a bit more…
Here are the 2 scripts that allow the prop spawning to happen:
LocalScript:
prop.MouseButton1Click:Connect(function()
local pos = HumanoidRootPart.Position + HumanoidRootPart.CFrame.LookVector * 5
local toCFrame = CFrame.new(pos)
SpawnProp:FireServer(prop.Name, toCFrame)
end)
ServerScript:
SpawnProp.OnServerEvent:Connect(function(player, prop, pos)
if Props:FindFirstChild(prop) then
local propToSpawn = Props:FindFirstChild(prop)
propToSpawn:Clone().Parent = workspace
if propToSpawn:IsA("Model") then
propToSpawn:SetPrimaryPartCFrame(pos)
else
propToSpawn.Position = pos
end
end
end)
Not quite sure what is wrong with the scripts…
Any help is appreciated, thank you in advance!