I'm currently making a drink that freezes the player by anchoring them, no errors pops up but the player is not anchored, does anyone know how to fix this?

local camera = game.Workspace.CurrentCamera
local man = script.Parent.Parent

script.Parent.Equipped:Connect(function(Mouse)
	Mouse.Button1Down:Connect(function()
	animation=game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) --play animation
		wait(3)
		camera.CameraType = Enum.CameraType.Scriptable --makes camera not move
		camera:GetPropertyChangedSignal("CameraType"):Wait()  --double check if camera can move i think
		camera.CameraType = Enum.camera.CameraType.Scriptable -- makes camera not move
		for child in pairs(man:GetChildren()) do --get children of script.Parent.Parent
			if child:IsA('Part', 'MeshPart') then -- if child is a meshpart or a part
				child.Anchored = true -- anchors it
			end
			end
	     end)

2 comments

0

Ok, why can't you reference "man" as game.Players.LocalPlayer.Character? Is it not quite literally the same exact thing, only more logical?

0

get property signal change will happen after the camera changes successfully I believe, thus makes it so you are infinite yielding there. you should be able to remove that and get it working