Okay so my goal is to basically the player has a “bite” tool when a player walks near a npc the “bite” gui shows and when the player clicks they play an animation and sticks to the player until they hit a close button.
I already have a animation button and know how to make a freeze script.
I’m just wondering how you would make the player follow the npc (Stick to the NPC)
Maybe you could make a loop and constantly change the player’s position to the npc’s position
Maybe would that require a function? Sorry I’m not great at scripting
You don’t really need a function for that, but you can make one for orginization
while sticking == true do
character.HumanoidRootPart.Position = Npc.HumanoidRootPart.Position
end
wow I didn’t know you could change the position that easy
No you need to get the player’s character and the npc as well
I know it would end up laggy…
You can probably have a CFrameValue which value is the cframes of both players based on the biting person’s to :ToObjectSpace(). Set the CFrame of the second player to first player :ToWorldSpace(CFrameValue.Value) Then you can weld them together.
Put a wait() function in the loop so it won’t lag as much, but it will lower the resolution and it may look like the player is lagging (if you lower it too much)
You can also just change the player’s position with a if statement, (where you code how the npc walks)
if biting == true then
character.Position... -- Write stuf here
end
Changed the script a bit.
It’s not done
local Npc = game.workspace.NPC
local Player = game:GetService("Players")
local sticking = Player.HumanoidRootPart.Position
while sticking == true do
Player.HumanoidRootPart.Position = Npc.HumanoidRootPart.Position
end
game:GetService(“Players”) Gets all the players in the server. If you have a button that turns on “bite” then put this script in there and grab the local Player.
Also, put a wait() or otherwise your game will crash
You can try welding the torso of the player to the npcs body part