First of all, I'm going to start with what it currently looks like https://gyazo.com/af7b3538ed9de5c2e75d5a610893b967
I want the yellow bullet to face straight out from the player's body, but the issue is I can't get it to rotate and face in the correct direction. My script is below, thank you all so much. (This is in a Server Script)
local Time = 6
local e = 5
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local M6D = Instance.new("Motor6D", char.Torso)
M6D.Name = "ToolGrip"
end)
end)
local sound = game.ReplicatedStorage.Sounds.TommyGun
local sounddos = game.ReplicatedStorage.Sounds.Stab
game.ReplicatedStorage.JHamonReps.GunHit.OnServerEvent:Connect(function(player, humanoid)
local ssound = sounddos:Clone()
ssound.Parent = humanoid.Parent.Head
ssound:Play()
end)
game.ReplicatedStorage.JHamonReps.GunHit.OnServerEvent:Connect(function(player, humanoid)
if humanoid.Health >= 1 then
humanoid.Health = humanoid.Health - 1
elseif humanoid.Health < 1 then
humanoid.Health = 0
end
end)
game.ReplicatedStorage.JHamonReps.AttachGun.OnServerEvent:Connect(function(plr,location)
local csound = sound:Clone()
csound.Parent = plr.Character.Head
csound:Play()
local bt = game.ReplicatedStorage.JHGun:Clone()
bt.Parent = plr.Character
plr.Character.Torso.ToolGrip.Part0 = plr.Character.Torso
plr.Character.Torso.ToolGrip.Part1 = bt.BodyAttach
local pp = Instance.new("Part")
pp.Transparency = 1
pp.Parent = plr.Character
while Time > 0 do
if e < 1 then
pp:Destroy()
e = 5
pp = Instance.new("Part")
pp.Transparency = 1
pp.Parent = plr.Character
end
local be = game.ReplicatedStorage.Bullet:Clone()
be.Parent = plr.Character.Part
be.CFrame = plr.Character.HumanoidRootPart.CFrame + plr.Character.HumanoidRootPart.CFrame.LookVector*10
be.CFrame = be.CFrame + Vector3.fromAxis(Enum.Axis.X, 90)
e = e -1
wait(0.1)
Time = Time - 0.08
plr.Character.Part:WaitForChild("Bullet").Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid ~= plr.Character.Humanoid then
if plr.Character.Humanoid.Health > 0 then
if hit.Parent.Humanoid.Health >= 1 then
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 1
elseif hit.Parent.Humanoid.Health < 1 then
hit.Parent.Humanoid.Health = 0
end
end
end
end)
end
pp:Destroy()
csound:Stop()
end)
game.ReplicatedStorage.JHamonReps.DetachGun.OnServerEvent:Connect(function(plr)
plr.Character.JHGun:Destroy()
plr.Character.Torso.ToolGrip.Part1 = nil
end)
Yes, I am aware of how sloppy this is but that is not the issue lol.
(The rotation/CFraming part is line 49 to 52)
