local player = game:GetService("Players"):GetPlayerFromCharacter(tool.Parent)
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
tell me if there is anything wrong please
local player = game:GetService("Players"):GetPlayerFromCharacter(tool.Parent)
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
tell me if there is anything wrong please
Did it have any errors in output, if it didnât then it might be a problem with the game. Is there a gui or script overriding the mousebutton1 event?
Doesnât the characterâs humanoid take damage by any of the tries mentioned earlier?!
only other script i have is a minimap gui, ill turn off the script and see if thatâll fix it
remade the script somewhat, this worked for me
local tool = script.Parent
local Character
local function Equipped()
Character = script.Parent.Parent
end
local function Unequipped()
Character = nil
end
local function instantkill()
if Character then
Character:WaitForChild("Humanoid"):TakeDamage(100)
end
end
tool.Activated:Connect(instantkill)
tool.Equipped:Connect(Equipped)
tool.Unequipped:Connect(Unequipped)
basically just changed it so whenever it gets equipped it sets the character variable to whoever has it currently equipped
unfortunately no it does not
iâll try to see if that works
it does not
im starting to believe something is wrong with my studios
are you sure? it worked for me.
Make sure its in a serverscript and you are not in FF for it to work
and also the script is parented under the tool, not the handle
It seems that the script is fine (the one you provided), in the tool are you using a part, there is a feature called RequireHandle, that may be it, please check if I am correct.
actually you dont need to get the player to get the character as you already have their character.
meaning script.Parent.Parent is their character
its a regular script and it is under the tool
you sure you have the forcefield off?
when you try to use the tool
omfg that worked, thanks bro, and everyone else
No problem, please check me as solution!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.