My remote event script isn't working. I am trying to do: When the player picks up a tool a variable is changed stating that the player has picked up the tool.
First script: (Local Script)
local tool = script.Parent.Parent
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local humanoid = character:WaitForChild("Humanoid")
--Remote Events Variables
tool.Equipped:Connect(function()
wait()
humanoid.Health = 100
if game.SoundService.GlobalToolKey.Value == script.Parent.ToolKey.Value then -- safety key
game.ReplicatedStorage.RemoteEvents.HolderOn:FireServer()
--PLAYER HAS PICKED UP THE ITEM
else -- If the tool's key doesn't match the global one: (Kicking the player)
script.Parent.Parent:Destroy()
game.Players.LocalPlayer:Kick(" We know you are hacking you little dandelion.")
end
end)
tool.AncestryChanged:Connect(function()
--ITEM WAS DROPPED
game.ReplicatedStorage.RemoteEvents.HolderOff:FireServer() ---
print("Picked up")
end)
print("LastCheck")
humanoid.Changed:Connect(function()
if humanoid.Health == 0 then
game.ReplicatedStorage.RemoteEvents.HolderOff:FireServer() ---
print("Item dropped || Player Died")
--PLAYER HAS DROPPED THE ITEM
end
end)
tool.Unequipped:Connect(function()
wait()
humanoid.Health = 100
--PLAYER HAS DONE NOTHING JUST UNEQUIPPED
end)
Second Script: (Normal Script)
local function ItemPickedUp()
print("Item picked up!")
script.Parent.Value = true
end
game.ReplicatedStorage.RemoteEvents.HolderOn.OnServerEvent(ItemPickedUp)
If you need more info feel free to ask me.
