The last guy didn’t really solve my problem, but during that time i made slight adjustments to the code, as it previously looked like this:
local player = game.Players.LocalPlayer.PlayerCharacter
while true do
player.Position = player.Position + Vector3.new(Random, Random, Random)
if
game.StarterGui.ScreenGui.Stop.MouseButton1Click
then
break
end
game.StarterGui.ScreenGui.Stop.MouseButton1Click:Connect()
end
Updated version looks like this:
local button = script.Parent
local player = game.Players.LocalPlayer
button.MouseButton1Click:Connect(function(player)
if button.MouseButton1Click then
player.HumanoidRootPart.Position = player.HumanoidRootPart.Position + Vector3.new(-159.99, -24.118, -59.804)
print "Imprisoned"
end
end)
For some reason this new code outputs weird error message in the output and refuses to work(By the way, if i try to add .Character , it outputs exact same thing, but with said instance):