Whats the problem?
I have created a LocalScript under StarterGUI, when you touch a part a room will load and when you are not touching it loads out. Although I a struggling to make this only happen for one player, this happens for the whole server even though its’ a local script. Is there a way to make this only load for certain players?
The part is inside a folder named “Render”.
local Player = game.Players.LocalPlayer
local RenderFolder = game.ReplicatedStorage.RenderUpstairs
local Part = workspace.Render.one
Part.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
RenderFolder.Parent = workspace
end
end)
Part.TouchEnded:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
RenderFolder.Parent = game.ReplicatedStorage
end
end)
local Player = game.Players.LocalPlayer
local RenderFolder = game.ReplicatedStorage.RenderUpstairs
local Part = workspace.Render.one
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
Part.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent:FindFirstChild("Humanoid") == Humanoid then
RenderFolder.Parent = workspace
end
end)
Part.TouchEnded:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent:FindFirstChild("Humanoid") == Humanoid then
RenderFolder.Parent = game.ReplicatedStorage
end
end)
All it does is checks whether or not the Humanoid is the Local Players Humanoid.