Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
PhaZeRO 30
8 years ago

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
Scripts can't access Local Player. User#11440 120 — 8y
0
Server Scripts can't access LocalPlayer* And LocalScripts do not work in Workspace. M39a9am3R 3210 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

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

Ad

Answer this question