hey so im trying to make it so my script does something in this function once it recieves a remote event firing, the event fires but nothing seems to happen.
here’s the code, im not really sure what went wrong but there arent any errors
local weaponinfo = {
physical = true,
fist = true,
damage = 4.5,
}
local tool = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = game:GetService("Players"):GetPlayerFromCharacter(tool.Parent)
if player then
local character = player.Character
local handlerfolder = character:WaitForChild("handlerfolder")
local remfolder = handlerfolder:WaitForChild("Remotes")
local m1 = remfolder:WaitForChild("M1")
print("one")
m1.OnServerEvent:Connect(function(plr)
print("two")
local player = game:GetService("Players"):GetPlayerFromCharacter(tool.Parent)
if player then
local character = player.Character
local Humanoid = character.Humanoid
local setupfolder = character.setupfolder
local combo = setupfolder.Combo
local combotimer = setupfolder.ComboTimer
print("three")
local function checkForStun(festy)
for _, tag in pairs(festy) do
if character:FindFirstChild(tag) then
return true
end
end
end
if checkForStun({"Stun", "Action", "Knocked", "Blocking", "Casting"}) then return end
if tick() - combotimer.Value > 2.25 then
combo.Value = 0
end
print("four")
if combo.Value >=4 then
combo.Value = 3
end
combotimer.Value = tick()
combo.Value += 1
local animation = Humanoid:LoadAnimation(ReplicatedStorage.Animations:FindFirstChild("Hit".. combo.Value))
animation:Play()
print("five")
task.wait(0.35)
if combo.Value >=4 then
weaponinfo.knockback = true
weaponinfo.ragdoll = true
end
end
end)
end
youre checking if the tool is the parent of the players character instantly after the script runs, if its not then the script is not gonna run, replace the lines with repeat task.wait() until player
local player: Player
repeat
player = game:GetService("Players"):GetPlayerFromCharacter(tool.Parent)
task.wait()
until player ~= nil
The idea is to repeat trying to get the player until it succeeds. This should only be applicable if your tool cannot be unequipped or dropped. Does your tool spawn directly in the player’s character, or do you give it to the player’s backpack or workspace?
they would start with this one yeah, but it’s subject to change based on what weapon they choose to use
other than that they always start with whatever weapon they have in their backpack and it isnt droppable
this had a lot of errors in the script, i assume by != you mispelled and meant ~= right?
i also removed local player since there were less errors that way and i dont think it was necessary… i think?
heres the script after editing that and adding it in
I did mean ~= but local player beforehand is necissary. local player: Player is even better. I copied your text from the forums so those quotes in GetService aren’t real ascii quotes. I’ve edited my post.