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

How do I make my gun FE Compatible?

Asked by
aindev 4
6 years ago


local player = game.Players.LocalPlayer local mouse = player:GetMouse() local tool = script.Parent local handle = tool.Handle function onClick() local gunharm = Instance.new("Part", workspace) gunharm.Anchored = true gunharm.BrickColor = BrickColor.new("CGA brown") gunharm.Material = Enum.Material.Neon gunharm.Orientation = handle.Orientation gunharm.Name = "gunharm" gunharm.Size = Vector3.new(1.16, 0.41, 1.13) gunharm.Position = game.Players.LocalPlayer:GetMouse().Hit.p handle.Sound:Play() gunharm.Touched:connect(function(hit) hit.Parent:FindFirstChild("Humanoid").Health = hit.Parent:FindFirstChild("Humanoid").Health - 30 end) wait(0.0006) gunharm:Destroy() end game.ReplicatedStorage.compat1:FireServer(player, onClick) script.Parent.Activated:Connect(onClick)

Please help me.

1 answer

Log in to vote
0
Answered by
herrtt 387 Moderation Voter
6 years ago
Edited 6 years ago
--Server Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remote = Instance.new("RemoteEvent")
remote.Parent = replicated
remote.Name = "damageRemote"

function damagePlayer(plr, target, dmg)
    target.Character.Humanoid:TakeDamage(dmg)
end
--Local script
local replicated = game:GetService("ReplicatedStorage")
local remote = replicated:WaitForChild("damageRemote")

remote:FireServer(<plr>, 10)

--This will damage the players health by 10 using a remote

Just a little example of how to use a remote, in this case the Player will be able to damage another Player

Here you have some links that will help you learn the usage of remote events and functions and how to use them.

https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events https://www.youtube.com/watch?v=wic-N4JiFss&t=0s https://www.youtube.com/watch?v=4Dc_bri9mjs https://www.youtube.com/watch?v=C0qQ4lDa3t0&t=0s

Ad

Answer this question