Yes the script is parented directly to the Player instance
Parent the script to PlayerScripts or another instance where LocalScripts can run.
You can just put the script in StarterPlayerScripts in studio, and the game will automatically clone the script into PlayerScripts.
I can’t really do that because this is one of the scripts the player can choose from
The last part is optional, but the first part is not for your script to work.
My game is like those script fighting games where the player gets to choose their scripts. If the players can’t choose them then my game can’t work ._.
Your game will still work; you need to parent the script to an instance where LocalScripts can run in.
Simply parent it to the Character Model
I fixed this problem by re writing this script. I didn’t use humanoid:LoadAnimation() and I also put this script inside the player character
local player = game:GetService("Players").LocalPlayer
local character = script.Parent
local hum = character:WaitForChild("Humanoid")
local ui = game:GetService("UserInputService")
local rightarm = character:WaitForChild("Right Arm")
local leftarm = character:WaitForChild("Left Arm")
local rightleg = character:WaitForChild("Right Leg")
local leftleg = character:WaitForChild("Left Leg")
local hitevent = game:GetService("ReplicatedStorage").re.hit
local gateevent = game.ReplicatedStorage.re.gates
local damage = 5
local gates = 0
local attacking = false
local cooled1 = 1
local cooled2 = 5
local cooled3 = 10
local superwait = 30
local transform = false
ui.InputBegan:Connect(function(input)
local anims = character:WaitForChild("Anims")
print("ui input")
if input.KeyCode == Enum.KeyCode.Q and attacking == false then
local punchanim = {"Left", "Right"}
local chance = math.random(1, #punchanim)
if punchanim[chance] == "Left" then
local anim = hum:LoadAnimation(anims.Left)
attacking = true
anim:Play()
leftarm.Touched:Connect(function(hit)
hitevent:FireServer(hit, damage)
end)
wait(cooled1)
attacking = false
elseif punchanim[chance] == "Right" then
local anim = hum:LoadAnimation(anims.Right)
attacking = true
anim:Play()
rightarm.Touched:Connect(function(hit)
hitevent:FireServer(hit, damage)
end)
wait(cooled1)
attacking = false
end
end
end)