First of all, this script is a script of the taser tool. I’ve completed this code and now I’m trying to apply it to a game, so I’m wondering if it’s safe from exploiters. (I don’t think it’s safe)
I am posting this because I want to get the vulnerabilities of this script and ways to improve it.
--Client
local d = false
local w = false
local plr = game.Players.LocalPlayer
local Message = require(game.ReplicatedStorage.MessageModule)
repeat wait(1) until plr.Character
--Animation
local character = plr.Character
local humanoid = character:WaitForChild("Humanoid")
local idle = script.Parent.Animations.Idle
local Fire = script.Parent.Animations.Fire
local Reload = script.Parent.Animations.Fire
local animtrack = humanoid:LoadAnimation(idle)
local animtrack2 = humanoid:LoadAnimation(Fire)
local animtrack3 = humanoid:LoadAnimation(Reload)
script.Parent.Unequipped:connect(function()
animtrack:Stop()
animtrack2:Stop()
animtrack3:Stop()
end)
script.Parent.Equipped:Connect(function(mouse)
animtrack:Play()
mouse.Button1Down:Connect(function()
if mouse.Target == nil then
if d == false then
d = true
animtrack2:Play()
script.Parent.Flam:FireServer()
game.Workspace.CurrentCamera.FieldOfView = 75
wait(0.02)
game.Workspace.CurrentCamera.FieldOfView = 70
wait(4)
d = false
else
if w == false then
w = true
Message.ShowMessage(plr,"Please Wait!")
w = false
end
end
return end
if d == false then
d = true
local hitp = mouse.Hit.p
script.Parent.Bullet:FireServer(hitp)
script.Parent.Flam:FireServer()
animtrack2:Play()
game.Workspace.CurrentCamera.FieldOfView = 75
wait(0.02)
game.Workspace.CurrentCamera.FieldOfView = 70
local vplrh = mouse.Target.Parent:FindFirstChild("Head")
local avplrh = mouse.Target.Parent.Parent:FindFirstChild("Head")
if vplrh or avplrh then --idk
if vplrh then
if (script.Parent.Parent.Head.Position - mouse.Target.Parent.Head.Position).magnitude <= 35 then
local vplr = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent)
local vchar = mouse.Target.Parent
game.ReplicatedStorage.Taser:FireServer(vplr,vchar)
end
end
if avplrh then
if (script.Parent.Parent.Head.Position - mouse.Target.Parent.Parent.Head.Position).magnitude <= 35 then
if mouse.Target.Parent:isA("Accessory") then
local vplr = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent.Parent)
local vchar = mouse.Target.Parent.Parent
game.ReplicatedStorage.Taser:FireServer(vplr,vchar)
end
end
end
end
wait(4)
d = false
else
if w == false then
w = true
Message.ShowMessage(plr,"Please Wait!")
w = false
end
end
end)
end)
--Server
local module = require(game.ReplicatedStorage.RagdollScript)
game.ReplicatedStorage.Taser.OnServerEvent:Connect(function(plr,vplr,vchar)
if (plr.Character.Head.Position - vchar.Head.Position).magnitude <= 40 then
module.Ragdoll(vchar, vplr)
wait(4)
module.Stand(vchar, vplr, vchar.Humanoid)
else
print("HaCkEr")
end
end)