You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
How to teleport my Character using a RemoteEvent?
What is the issue? Include screenshots / videos if possible!
How to teleport my Character using a RemoteEvent?
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I haven’t tried any solutions so far. I did look for solutions on the Developer Hub.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
In your localscript, call the :FireServer() method wherever you want in your code, and that will make the OnServerEvent connection run on the server’s side.
function OnClick()
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
script.Parent.MouseButton1Click:Connect(OnClick)
Okay, so since the localscript for the textbutton looks fine as is, you can make your serverscript into something along the lines of
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local destination = CFrame.new(0,10,0) -- change 0,10,0 to whatever vector3 u want
character:PivotTo(CFrame.new(destination))
end)
I still got the same result of now my TextButton isn’t working anymore.
function OnClick()
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local destination = CFrame.new(857.286, 339.376, -98.523) -- change 857.286, 339.376, -98.523 to whatever vector3 u want
character:PivotTo(CFrame.new(destination))
game.StarterGui.ScreenGui.Frame.Chinatown:Destroy()
end)
script.Parent.MouseButton1Click:Connect(OnClick)
end