I want to make NPC’s Name with player’s name → different for every player, should I use localScript or Script? And where should I put it? But I can’t get the name of the NPC I try to get the name with this:
local LocalNPC = game.Workspace:findFirstChild(player.Name)
game.Players.PlayerAdded:Connect(function(player)
LocalNPC:ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(player.UserId))
game.Workspace.Dummy2.Name = player.Name
end)`
The script located in workspace with a normal script, not localscript
Thanks! Hopefully someone know how to fix this :D.
One more thing, this is for a story game, so I have the main script which is a script, not local script. And I also use the dummy2 in the script, how do I change this?
For example: local controller = game.Workspace.Dummy2.Humanoid setDialogueImageEvent:FireAllClients(game.Workspace.Dummy2, Color3.new(0.627451, 1, 0.815686))
You don’t have to change this! The name change is only done on the client, so you only need to do something if you’re accessing the Dummy from the client.
miscellaneous Problem:
So I just realise I have this local script too that I used to play animation. maybe you ask why I put it in the local script? Because I already try it when I put it in the script, the animation not loading because of laggy
so this is the script of the animation script
local controller = game.Workspace.Dummy2.Humanoid
local AnimCall = Instance.new("Animation")
AnimCall.AnimationId = "http://www.roblox.com/asset/?id=9112553567"
local Call = controller:LoadAnimation(AnimCall)
local PlayerCallAnimationEvent = game.ReplicatedStorage.Remotes.PlayerCallAnimationEvent
PlayerCallAnimationEvent.OnClientEvent:Connect(function()
Call:Play()
wait(Call.Length - 0.1)
Call:AdjustSpeed(0)
end)