I’m pretty new to scripting but understand how most things work but can’t seem to find much info online about how I’d make an Equip system which checks what Value/Item you have Equipped then runs an Event/Function based on which item has the Equipped status.
Any advice or guidance is much appreciated, Thanks
Use RemoteEvent to trigger a script on the server to kill the player and for effects/animations.
Example:
LocalScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
Kill = ReplicatedStorage:WaitForChild("Kill")
local Player = game:GetService("Players").LocalPlayer
Mouse = Player:GetMouse()
script.Parent.Activated:Connect(function()
if Mouse.Target ~= nil then
if Mouse.Target.Parent:FindFirstChild("Humanoid") then
Kill:FireServer(Mouse.Target.Parent)
end
end
end)
KillScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
Kill = ReplicatedStorage:WaitForChild("Kill")
Kill.OnServerEvent:Connect(function(Player,Model)
-- Code for effects --
Model.Humanoid:TakeDamage(Model.Humanoid.MaxHealth)
print(Player.Name "has killed" Model.Name)
end)