Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

part.TopSurface = "Smooth"
part.BottomSurface = "Smooth"
part.BrickColor = BrickColor.new("Gold")
part.CanCollide = false
part.CFrame = tool.Handle.CFrame
part.CFrame = CFrame.new(part.Position,mouse.Hit.p)
local v = Instance.new("BodyVelocity",part)
v.Velocity = part.CFrame.lookVector * 500
v.maxForce = Vector3.new(math.huge, math.huge, math.huge)
tool.Handle.Sound:Play()
part.Touched:connect(function(hit)
    humanoid = hit.Parent:FindFirstChild("Humanoid")
    if humanoid and humanoid ~= game.Players.LocalPlayer.Character.Humanoid then
        humanoid.Health = humanoid.Health - 10
    end
end)
enabled = false
wait(0.5)
enabled = true
end

end)`

and if it looks weird idk how to fix im very new to site have not used it often

2 answers

Log in to vote
0
Answered by 6 years ago

player = game.Players.LocalPlayer mouse = player:GetMouse() tool = script.Parent

cannot be in normal script

0
wouldnt work i put it in both local scripts FaZe_McDouble -7 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

wouldnt work i put it in both local scripts

Answer this question