Tool not working as title describes, When your equipped it should play the animation and loop and give you points, When unequipped it should stop, yet it doesnt work
local remote = game.ReplicatedStorage.RemoteEvents:FindFirstChild("Mind")
local animation = script.Parent:WaitForChild("Action")
-- Animation = https://www.roblox.com/library/4955189499/Meditating
script.Parent.Equipped:Connect(function(plr)
animation:Play()
local str = 3189361278316378126378216312783681273612873112312
while wait(.2) do
remote:FireServer(str)
end
end)
script.Parent.Unequipped:Connect(function()
animation:Stop()
end)
The animation should also play, how do i do this, sorry if this is basic im relatively new.
local remote = game.ReplicatedStorage.RemoteEvents:FindFirstChild("Mind")
local player = game.Players.LocalPlayer
--Load animation "Action"
local animation = player.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent:WaitForChild("Action"))
-- Animation = https://www.roblox.com/library/4955189499/Meditating
script.Parent.Equipped:Connect(function(plr)
animation:Play()
local str = 3189361278316378126378216312783681273612873112312
while wait(.2) do
remote:FireServer(str)
end
end)
script.Parent.Unequipped:Connect(function()
animation:Stop()
end)
Strength is random as its a key for an anti exploit to stop exploiters firing events, the key has to be that sent across. There is no errors in the output.
Exploiters can still look throught your code in local and send the remote event. Best way to protect your game from them is with sanity checks in the server code (Exploiters can’t access the code in serverscriptservice and serverstorage).
local Remote = game.ReplicatedStorage.RemoteEvents:FindFirstChild("Mind")
local AnimInstance = script.Parent:WaitForChild("Action")
local plr = game.Players.LocalPlayer
local Chr = plr.Character or plr.CharacterAdded:Wait()
local hum = Chr:WaitForChild("Humanoid")
local Anim = hum:LoadAnimation(AnimInstance) -- Load the Animation into the player
local AnimPlaying = false
script.Parent.Equipped:Connect(function(plr)
animation:Play()
AnimPlaying = true
local str = 3189361278316378126378216312783681273612873112312
repeat
wait(0.2)
--Fire RemoteEvent here
until AnimPlaying = false
end)
script.Parent.Unequipped:Connect(function()
AnimPlaying = false
animation:Stop()
end)