You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to make a script that updates the mouse position, and points the models at the mouse’s current position (so that all of the models don’t point at same spot) -
What is the issue? Include screenshots / videos if possible!
Script keeps giving me Set Primary Part CFrame Errors
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have looked at the dev hub, and ive also tried moving some parts of my script around, giving me different error messages, usually pertaining to whatever is after the Fire client and OnServerEvent(P,Pos) lines
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Server script (the one that aims and updates according to local script)
character = script.Parent.Parent
player = game.Players:GetPlayerFromCharacter(character)
local Cooldown = false
script.Parent.ShootBlaster.OnServerEvent:Connect(function()
if Cooldown == false then
Cooldown = true
for i=1,3 do
spawn(function()
local e = game.ReplicatedStorage.bones["DTBone"]:Clone()
e.Parent = workspace
e.PrimaryPart = e.HumanoidRootPart
e.Owner.Value = player.Name
wait(0.5)
script.Parent.aim:FireClient(player)
script.Parent.aim.OnServerEvent:Connect(function(P,Pos)
e:SetPrimaryPartCFrame(CFrame.new(player.Character.Head.Position + Vector3.new(math.random(-25,25),math.random(5,7),math.random(-25,25)),Pos) * CFrame.Angles(0,math.rad(180),0))
wait(1.9)
e:Destroy()
end)
end)
wait(0.5)
end
--updates gui value to start cooldown
player.PlayerGui.SansBTcd.Value.Value = true
wait(3)
Cooldown = false
end
end)
Local script (the one that updates mouse.hit.position everytime event is fired)
script.Parent.OnClientEvent:Connect(function(plr)
local Mouse = game.Players.LocalPlayer:GetMouse()
script.Parent:FireServer(Mouse.Hit.Position)
end)