How do I make an enemy teleporter script out of this?

I made a enemy teleporter script (which I’m using for my SCP-087 game) but I cannot figure out why it isn’t working. What I’m trying to achieve is a enemy teleporter but it isn’t working.

I’ve looked for solutions on the devforum and on other websites but unfortunately, I cannot find any. Note that I am a basic scripter and I work mainly on building and designs.

local part = script.Parent

part.Touched:Connect(function(hit)
	while true do
		wait()
		if game.workspace.Value.Value == "1" then
			if hit.Parent:FindFirstChild("Humanoid") then
				local player = game.Players:GetPlayerFromCharacter(hit.Parent)
				game.Workspace["SCP-087-1"]:SetPrimaryPartCFrame(CFrame.new(-6.113, 1552.635, -10.6))
				player.Character.Humanoid.WalkSpeed = 1
				game.Workspace["SCP-087-1"].Humanoid.WalkSpeed = 3.2
			end
		end
	end
end)

Hi!

If the “game.workspace.Value” is a IntValue or a NumberValue you don’t have to put " " in your script, because if you do that the script will be waiting for a String, instead of a Number

it should look something like this:

if game.workspace.Value.Value == 1 then
1 Like