Hello,back again with the gun thing;I made a last question about this before on other problem,but I changed the gun info.The error I get is of the title.The local script of the gun is:
local BulletEvent = game:GetService("ReplicatedStorage"):WaitForChild("BulletShoot")
local Tool = script.Parent
local Player = game.Players.LocalPlayer
Tool.Equipped:Connect(function(mouse)
mouse.Button1Down:Connect(function()
BulletEvent:FireServer(Player,Tool.Handle.Shoot.Position, mouse.Hit.Position)
end)
end)
And the server script for the remote event(Error on line 6)
local BulletEvent = game:GetService("ReplicatedStorage"):WaitForChild("BulletShoot")
local RS = game:GetService("ReplicatedStorage")
BulletEvent.OnServerEvent:Connect(function(Player,FromP,ToP)
local castRay = Ray.new(FromP, (ToP-FromP).unit * 100)
local hit,Position = workspace:FindPartOnRay(castRay, Player.Character)
if hit then
local Human = hit.Parent:FindFirstChild("Humanoid")
if Human then
Human:TakeDamage(20)
end
end
local Laser = Instance.new("Part",workspace)
Laser.BrickColor = BrickColor.new("Really red")
Laser.Material = "Neon"
Laser.CanCollide = false
local Dist = (ToP - FromP).magnitude
Laser.CFrame = CFrame.new(FromP, Position)
Laser.Size = CFrame.new(0.1,0.1,Dist) * CFrame.new(0,0,-Dist/2)
game.Debris:AddItem(Laser,0.01)
end)
Thanks. (EXTRA: If I update a question,I need to wait more for an new answer?)
