so im making a script to fire some events based on values when a player moves but all of the sudden script stops working and doesnt fire event i tried debugging and not a single thing works.
local script:
local Player = game.Players.LocalPlayer local Character = Player:WaitForChild("Character") local Humanoid = Character.Humanoid local speed = Player.stats.Speed local equipped = Character:WaitForChild("EquippedWeight") local VectorZero = Vector3.new(0, 0, 0) local db = false local function Moved() if Humanoid.MoveDirection ~= VectorZero then if not db then db = true if equipped == "none" then game.ReplicatedStorage.Stats.RUN:FireServer() -- fires event to add speed elseif equipped == "100lbs" then if speed.Value >= 100 and speed.Value < 5000 then game.ReplicatedStorage.Stats.RUN:FireServer() else game.ReplicatedStorage.Errors.NotWeight:FireServer() -- fires event that opens gui saying not enough stats end elseif equipped == "1ton" then if speed.Value >= 5000 and speed.Value < 500000 then game.ReplicatedStorage.Stats.RUN:FireServer() else game.ReplicatedStorage.Errors.NotWeight:FireServer() end elseif equipped == "10ton" then if speed.Value >= 500000 and speed.Value < 5000000 then game.ReplicatedStorage.Stats.RUN:FireServer() else game.ReplicatedStorage.Errors.NotWeight:FireServer() end end wait(3) db = false end else end end Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(Moved)
everything down to the last line doesnt work for some odd reason?
i dont know what im doing wrong so pls help.
server script:
game.ReplicatedStorage.Stats.RUN.OnServerEvent:connect(function(player) player.stats.Speed.Value = player.stats.Speed.Value + player.Character.SpeedAdd.Value end)
You’re comparing an instance with a string for some reason, did you mean to compare it’s value?
if equipped.Value == “none” then -- I assume it’s a StringValue -- ...