remote events will not work with weapons?
Asked by
6 years ago Edited 6 years ago
i tried another way to make weapons with fe on and i cant believe i cant do it. works in studio but not game and i tried multiple ways of waiting for the child so it loads in.
local script code that is in the handle
player = game.Players.LocalPlayer
mouse = player:GetMouse()
tool = script.Parent.Parent
enabled = true
tool.Activated:connect(function()
game.ReplicatedStorage.DamageEvent:FireServer()
end)
normal script that is meant to work when damageevent is fired
~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~
``
`player = game.Players.LocalPlayer
mouse = player:GetMouse()
tool = script.Parent
enabled = true
game.ReplicatedStorage.DamageEvent.OnServerEvent:connect(function()
if enabled == true then
local part = Instance.new("Part",game.Workspace)
game.Debris:AddItem(part,3)
part.Size = Vector3.new(0.1,0.1,3)
part.Material = Enum.Material.Neon
01 | part.TopSurface = "Smooth" |
02 | part.BottomSurface = "Smooth" |
03 | part.BrickColor = BrickColor.new( "Gold" ) |
04 | part.CanCollide = false |
05 | part.CFrame = tool.Handle.CFrame |
06 | part.CFrame = CFrame.new(part.Position,mouse.Hit.p) |
07 | local v = Instance.new( "BodyVelocity" ,part) |
08 | v.Velocity = part.CFrame.lookVector * 500 |
09 | v.maxForce = Vector 3. new( math.huge , math.huge , math.huge ) |
10 | tool.Handle.Sound:Play() |
11 | part.Touched:connect( function (hit) |
12 | humanoid = hit.Parent:FindFirstChild( "Humanoid" ) |
13 | if humanoid and humanoid ~ = game.Players.LocalPlayer.Character.Humanoid then |
14 | humanoid.Health = humanoid.Health - 10 |
end)`
and if it looks weird idk how to fix im very new to site have not used it often