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 be able to make a gun that shoots blocks from the muzzle.
- What is the issue? Include screenshots / videos if possible!
It keeps giving me this error:
Here is the local script that is inside the tool:
local mouse = game.Players.LocalPlayer:GetMouse()
local rs = game:GetService('ReplicatedStorage')
local Event = rs:WaitForChild('Shoot')
script.Parent.Activated:Connect(function()
print(mouse.Hit.Position)
Event:FireServer(mouse.Hit.Position, script.Parent.Handle.Muzzle.WorldPosition)
end)
And here is the server script, where it errors.
-- Variables
local rs = game:GetService('ReplicatedStorage')
local Event = rs:WaitForChild('Shoot')
-- event thing
Event.OnServerEvent:Connect(function(mouse, nozzle)
local turret = Instance.new("Part")
turret.BrickColor = BrickColor.Black()
turret.Shape = Enum.PartType.Ball
turret.Size = Vector3.new(1,1,1)
turret.Parent = workspace
turret.CFrame = CFrame.new(nozzle, mouse) -- It gives me the error here.
turret.Velocity = turret.CFrame.LookVector * 300
end)
If anyone could tell me the issue it would mean a lot!
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Yes I looked for help.