oh okay, will try that! thank you
Still the same
wait a minute, im a bit confused with this
So the inside the HelzaWalkScript, it should be like this right?
local Helza = game.Workspace.Helza
local WalkAnim = Instance.new("Animation")
WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=657564596"
local HelzaMoveEvent = game.ReplicatedStorage.Remotes.HelzaMoveEvent
local controller = Helza.Humanoid
local finishedwalk = true
local animation = controller:LoadAnimation(WalkAnim)
HelzaMoveEvent.OnClientEvent:Connect(function(EndPosition)
if finishedwalk == true then
finishedwalk = false
animation:Play()
Helza.Humanoid:MoveTo(EndPosition)
Helza.Humanoid.MoveToFinished:wait()
animation:Stop()
if EndPosition == game.Workspace.Destination2.Position then
HelzaMoveEvent:FireServer("HelzaSit")
end
finishedwalk = true
else
repeat wait() until finishedwalk == true
finishedwalk = false
animation:Play()
Helza.Humanoid:MoveTo(EndPosition)
Helza.Humanoid.MoveToFinished:wait()
animation:Stop()
finishedwalk = true
end
end)
Where should I put this?
HelzaMoveEvent.OnServerEvent:Connect(Function(plr, functiongive)
if functiongive == "HelzaSit" then
game.Workspace.Chair["School C hair"].Seat:Sit(game.Workspace.Helza.Humanoid)
end
end)
It needs to be this one.
local Helza = game.Workspace.Helza
local WalkAnim = Instance.new("Animation")
WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=657564596"
local HelzaMoveEvent = game.ReplicatedStorage.Remotes.HelzaMoveEvent
local controller = Helza.Humanoid
local finishedwalk = true
local animation = controller:LoadAnimation(WalkAnim)
HelzaMoveEvent.OnClientEvent:Connect(function(EndPosition)
if finishedwalk == true then
finishedwalk = false
animation:Play()
Helza.Humanoid:MoveTo(EndPosition)
Helza.Humanoid.MoveToFinished:wait()
animation:Stop()
if EndPosition == game.Workspace.Destination2.Position then
HelzaMoveEvent:FireServer("HelzaSit")
end
finishedwalk = true
else
repeat wait() until finishedwalk == true
finishedwalk = false
animation:Play()
Helza.Humanoid:MoveTo(EndPosition)
Helza.Humanoid.MoveToFinished:wait()
animation:Stop()
if EndPosition == game.Workspace.Destination2.Position then
HelzaMoveEvent:FireServer("HelzaSit")
end
finishedwalk = true
end
end)
And I recommend you to use Server-Sided to make the NPC walk instead of using a Client-Sided script.
Oh got it, thank you so much for your help!
wait, is there any relationship witht his problem? sometimes when I go away from the npc, the npc just start to walk in place, and when I come close to it, it start walking?
Unless you are trying to make NPC walk in a different direction with other players.
I don’t think so. But using Server-Sided will make it better because everyone can see it walk to the same path NPC is walking to. But if you want to use Client-Sided It’s Okay.
Wait, lemme make it clear
so this is the HelzaWalkScript
local Helza = game.Workspace.Helza
local WalkAnim = Instance.new("Animation")
WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=657564596"
local HelzaMoveEvent = game.ReplicatedStorage.Remotes.HelzaMoveEvent
local controller = Helza.Humanoid
local finishedwalk = true
local animation = controller:LoadAnimation(WalkAnim)
HelzaMoveEvent.OnClientEvent:Connect(function(EndPosition)
if finishedwalk == true then
finishedwalk = false
animation:Play()
Helza.Humanoid:MoveTo(EndPosition)
Helza.Humanoid.MoveToFinished:wait()
animation:Stop()
if EndPosition == game.Workspace.Destination2.Position then
HelzaMoveEvent:FireServer("HelzaSit")
end
finishedwalk = true
else
repeat wait() until finishedwalk == true
finishedwalk = false
animation:Play()
Helza.Humanoid:MoveTo(EndPosition)
Helza.Humanoid.MoveToFinished:wait()
animation:Stop()
if EndPosition == game.Workspace.Destination2.Position then
HelzaMoveEvent:FireServer("HelzaSit")
end
finishedwalk = true
end
end)
And this is the script that fire it
HelzaIdleEvent:FireAllClients()
HelzaMoveEvent:FireAllClients(game.Workspace.Destination1.Position)
HelzaMoveEvent:FireAllClients(game.Workspace.Destination2.Position)
wait(5)
setDialogueImageEvent:FireAllClients(game.Workspace.Teacher, Color3.new(0.627451, 1, 0.815686))
createDialogueEvent:FireAllClients("You gotta sit first, then I will tell it!")
ObjectiveEvent:FireAllClients("Sit in the class!")
ObjectiveTimeEvent:FireAllClients(20)
TimerEvent:FireAllClients(20)
wait(4)
game.Workspace.Chair["School C hair"].Seat:Sit(game.Workspace.Helza.Humanoid)
HelzaStopIdleEvent:FireAllClients()
Oh Okay, I will use server sided!
Nvm, that is the client sided, this is the server sided HelzaWalkScript
local Helza = game.Workspace.Helza
local WalkAnim = Instance.new("Animation")
WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=657564596"
local HelzaMoveEvent = game.ReplicatedStorage.Remotes.HelzaMoveEvent
local controller = Helza.Humanoid
local finishedwalk = true
local animation = controller:LoadAnimation(WalkAnim)
HelzaMoveEvent.OnClientEvent:Connect(function(EndPosition)
if finishedwalk == true then
finishedwalk = false
animation:Play()
Helza.Humanoid:MoveTo(EndPosition)
Helza.Humanoid.MoveToFinished:wait()
animation:Stop()
if EndPosition == game.Workspace.Destination2.Position then
HelzaMoveEvent:FireServer("HelzaSit")
end
finishedwalk = true
else
repeat wait() until finishedwalk == true
finishedwalk = false
animation:Play()
Helza.Humanoid:MoveTo(EndPosition)
Helza.Humanoid.MoveToFinished:wait()
animation:Stop()
if EndPosition == game.Workspace.Destination2.Position then
HelzaMoveEvent:FireServer("HelzaSit")
end
finishedwalk = true
end
end)
Server-Sided script cannot use the OnClientEvent function on remote event.
Oh, then how can I do that
So sorry for my dumbness!