Gui Button Teleporting issue

The error wont happen if you go to the actual part, thats the confusing part.

oh, thats true

why wont u just turn it off though

I hate to be a broken record, but for some reason findfirstchild forces the part to be loaded in, is there a way to incorporate something like findfirstchild in the script?

I already said, “my game is near 1400-1500 memory usage so loading all of the content at once would be taxing to mobile, console, and most pc users.” It also wouldnt be smooth gameplay so streaming enabled is very important to have on in my game.

did you try the serversided script i gave you?

Yes, but it had the same infinite yield thing, but it was the same as before if you go near the part the script works.

Ok then do this instead(it looks the same but i changed some parts)

-- localscript

local player = game.Players.LocalPlayer
local Character = player.Character
local Hum = Character:WaitForChild("HumanoidRootPart")

script.Parent.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.RemoteEvent:FireServer()
end)

-- server script
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
part = workspace.Environment.QT:FindFirstChild("MCave1")
player.Character.HumanoidRootPart.CFrame = part.CFrame - Vector3.new(0,0,-4)

end)

My bad I had to modify some things (such as changing some of the names in the script) and since im a little tired i messed up a couple times but im testing it right now.

AYYYYYY, YOU DID IT THANK YOU SO MUCH AND YOU TOO @ivandroide45 AND EVERYONE ELSE THAT HELPED ME

1 Like
-- Make sure this is a script not a local script
local part = Workspace.Environments.QT:FindFirstChildOfClass("Part")
script.Parent.MouseButton1Click:Connect(function(function(player)
     local Character = player.Character or player.Character:Wait()
     local Humanoid = Character.Humanoid --[[You do not have to put "WaitForChild" because this function 
   will take 20% longer then a dotted syntax/expression]]
     -- Do not move a "Humanoid" a humanoid is not a source of an instance in the world, you can only move a physical object such as a part of example
     local Character.HumanoidRootPart.CFrame = part.CFrame * Vector3.new(0,0,-4)
end)