I have made a tycoon NPC which if they work to they limit (which is a energy number value) it will jump of the chair and walk to the vending machine. However, the script worked, it jumping off, but the problem is about jumping! (i guess) the NPC jumping script is a serverside script but it behaved to jump off with a client script, the vending machine placement was a modulescript with a serverside (because you can see a machine in a serverside) but the npc act like it was a client side! is this a bug? or is my script error?
Video: (problem part)
Video: (full part)
NOTE: this is the moving script which will be cloned to the NPC when it was first finish the drinking script
Script in a NPC:
> local chair = script:WaitForChild("Chair").Value > local dapath = game:GetService("PathfindingService"):CreatePath() > while wait(math.random(1,2)) do > print("Staring...") > if script.Cooldown.Value == true then > print("Checking.......") > if script.Parent.Humanoid.SeatPart then > for i,v in pairs(game.Players:GetChildren()) do > if v.UserId == script.Parent.Owner.Value then > if script.Energy.Value < 0 or script.Energy.Value == 0 then > script.Cooldown.Value = false > --NEED TO REST > print("Going to resting...") > for i,v in pairs(game.Workspace.PlotDetails:GetChildren()) do > if v.Name == "VendingMachine" and v:FindFirstChild("Owner") and v:FindFirstChild("Owner").Value == script.Parent.Owner.Value then > local npcwalkpos = v:FindFirstChild("NPCWalkPos") > if npcwalkpos then > script.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping) > dapath:ComputeAsync(script.Parent.PrimaryPart.Position,npcwalkpos.Position) > local point = dapath:GetWaypoints() > for i,way in pairs(point) do > if way.Action == Enum.PathWaypointAction.Jump then > script.Parent.Humanoid.Jump = true > end > script.Parent.Humanoid:MoveTo(way.Position) > script.Parent.Humanoid.MoveToFinished:Wait() > end > wait(2) > --GETTING THE DRINKS > local bloxy = game.ReplicatedStorage.BloxyCola:Clone() > bloxy.Parent = script.Parent > while wait(math.random(0.1,0.2)) do > local drinking = bloxy.DrinkSound:Clone() > drinking.Parent = script.Parent:FindFirstChild("Head") > drinking.PlayOnRemove = true > drinking:Destroy() > if bloxy.Handle.Energy.Value <= 0 then > bloxy:Destroy() > script.Energy.Value = 1 > break > else > bloxy.Handle.Energy.Value = bloxy.Handle.Energy.Value - (math.random(5,10)* 2) > end > end > --GOING BACK TO WORK > dapath:ComputeAsync(script.Parent.PrimaryPart.Position,chair.Position) > local way = dapath:GetWaypoints() > for i,point in pairs(way) do > if point.Action == Enum.PathWaypointAction.Jump then > script.Parent.Humanoid.Jump = true > end > script.Parent.Humanoid:MoveTo(point.Position) > script.Parent.Humanoid.MoveToFinished:Wait() > end > --GG GAMING > repeat > print("Still finding a chair") > local daway = chair:Sit(script.Parent.Humanoid) > if script.Parent.Humanoid.SeatPart.Parent:FindFirstChild("Owner").Value == script.Parent.Owner.Value then > break > end > wait() > until false > script.Cooldown.Value = true > local dawaa = game.Lighting.ProgrammerRestScript:Clone() > dawaa.Parent = script.Parent > dawaa.Chair.Value = chair > dawaa.Disabled = false > script:Destroy() > end > end > end > elseif script.Energy.Value > 0 then > print("Decreasing") > print("More WORK!!") > script.Energy.Value = script.Energy.Value - (math.random(5,20)*5) > v.Coins.Value = v.Coins.Value + (10 * v.TreasureRate.Value) > v.XP.Value = v.XP.Value +(math.random(1,20) * v.TreasureRate.Value) > end > end > end > end > end > end
I can give you more information if you did ask me! But it need to be irrevant with the problems!