Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My teleporting script is having problems..?

Alright so this question was asked before by me, and they helped me update the script an extent but it still did and does not work, so I am going to need help yet again with it.

So here is the script they gave me.

local mult_ID = 34534
script.Parent.MouseClick:connect(function(player)
    if player then
        game:GetService("TeleportService"):Teleport(mult_ID, player)
    end
end)

The script is supposed to be when you click a certain brick you get teleported to a new game(the ID is just a random number value but I have used it with an actual games ID and it did not work)

2 comments

0

Is it a Server or Local Script?

0

It is a Server script within a part

1 answer

✓ Accepted answer

MouseClick is not an event of a part. If you want to detect when a player clicks on a part, you will have to use another method. One way to do that is to use a ClickDetector object, which will allow you to do exactly this.

Workspace
	Part
		ClickDetector
		Script

Above is the hierarchy order you should have

local ClickDetector = script.Parent.ClickDetector
local mult_ID = 34534

local function PartClickedBy(Player)
	if Player ~= nil then
		game:GetService("TeleportService"):Teleport(mult_ID, Player)
	end
end

ClickDetector.MouseClick:connect(PartClickedBy)

1 comment

0

Thank You! this was a needed script in my game! Thank You So Very Much!

This discussion is preserved as it was. New answers, comments, and votes are closed.