I am trying to make a Mjolnir, but I want it so that only I can equip it. If anyone else tries the weapon gets removed. But I dont know how to do this. Here is what I tried
local Humanoid = game.Players.LocalPlayer.Character.Humanoid
local Mjolnir = game.Players.LocalPlayer.Backpack:WaitForChild("Mjolnir")
local name = game.Players.LocalPlayer.Name
local tool = script.Parent
--Buffs--
tool.Equipped:connect(function()
if name ==("turbomegapower1234") then
Humanoid.MaxHealth = 100000
Humanoid.Health = 100000
Humanoid.WalkSpeed = 100
else
Mjolnir:Destroy()
end
end)
--Removing Buffs --
tool.Unequipped:connect(function()
if name ==("turbomegapower12345") then
Humanoid.MaxHealth = 100
Humanoid.Health = 100
Humanoid.WalkSpeed = 16
end
end)

1 comment
I'm not too good at scripting, but from what I see you haven't specified where your name is located (line 12 and 25)