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

Player goes invisible in play solo, but does not go invisible in the test server?

Basically, this script makes the player invisible when the seat is sat on. It checks if someone is sitting on it, gets all their hats and limbs and makes those invisible. It works in play solo, but it does not work in the test server. Why?

local Player = game.Players.LocalPlayer

local Seat = script.Parent

Seat.Changed:connect(function(property)
	if property == "Occupant" then
		for i, v in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
			if v:IsA("BasePart")then
				v.Transparency = 1
			end
			if v:IsA("Hat") then
				local Hat = v:FindFirstChild("Handle")
				Hat.Transparency = 1
			end
		end
	end
end)

2 comments

2

Scripts can't access Local Player.

0

Server Scripts can't access LocalPlayer* And LocalScripts do not work in Workspace.

1 answer

Add a

repeat wait() until game.Players.LocalPlayer.Character

so this gives the script to run after the player spawn because when u start a real or test server the scripts run immediately and the player hasn't spawn yet so it can't check who is who.

and if you're using a Normal script that script you have made will not work it should be in a LocalScript

note :if this solves the question just click Accept Answer

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