I'm trying to change the status of a string value in a tool using a local script and I'm not sure I'm doing it right. Anything helps.
Client:
local tool = script.Parent local RS = game:GetService("ReplicatedStorage") local RE = RS.Folder local Swing = RE.RemoteEvent local knifestatus = script.Parent.Attacking knifestatus.Value = "Idle" local animcooldown = false tool.Activated:Connect(function() if animcooldown == false then knifestatus.Value = "Attacking" Swing:FireServer(knifestatus.Value) animcooldown = true wait(0.5) animcooldown = false RS.RemoteEvent2:FireServer(knifestatus.Value) end end)
Server:
local Swing = game.ReplicatedStorage.Folder.RemoteEvent local changeattackvalue = game.ReplicatedStorage.RemoteEvent2 local anims = {4694617461, 4694596008, 4693890515 } Swing.OnServerEvent:Connect(function(plr,knifestatus) knifestatus = "Attacking" local char = game.Workspace:FindFirstChild(plr.Name) local human = char:FindFirstChild("Humanoid") local picked = math.random(1,#anims) local attackanim = Instance.new("Animation") print(picked) attackanim.AnimationId = "https://www.roblox.com/assets/?id=".. anims[picked] local attackanimload = human:LoadAnimation(attackanim) attackanimload:Play() end) changeattackvalue.OnServerEvent:Connect(function(plr,kinfestat) kinfestat = "Idle" end)