I have this tool that is supposed to shoot an bullet in the direction you click, however the bullet spawns in the middle of the map and just sort of falls into the abyss.
In a server script I have
local tool = script.Parent
local bullet = game.ReplicatedStorage.bullets.needle
local sound = tool.Sound
function pew()
sound:Play()
local arrow = bullet:clone()
arrow.Parent = tool
game:GetService("Debris"):AddItem(arrow, .22)
tool.ManualActivationOnly = true
wait (.3)
tool.ManualActivationOnly = false
end
tool.Activated:connect(pew)
which spawns the object serverside and what not
in a local script i have
local tool = script.Parent
local mouse = game.Players.LocalPlayer:GetMouse()
function pew()
wait (.01)
local arrow = script.Parent.needle
arrow.CFrame = CFrame.new(tool.Handle.Position, mouse.Hit.p)
local v = Instance.new ("BodyVelocity", arrow)
v.velocity = arrow.CFrame.lookVector *90
v.maxForce = Vector3.new(math.huge, math.huge, math.huge)
end
tool.Activated:connect(pew)
which gives the bullet it's momentum and stuff
When tested in studio mode it works perfectly, but when tested in server the bullet goes limp half way across the world as previously mentioned. What's wrong here?
