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

My script make me invisible in my client but my friend still see I'm not invisible?

Asked by 6 years ago

I have made a script which make you invisible by clicking on the text button:

local player = game.Players.LocalPlayer
local char = player.Character
script.Parent.MouseButton1Click:Connect(function()

    char.Head.Transparency = 1
    char.Head.Face.Transparency = 1
    char.Torso.Transparency = 1
    char["Left Arm"].Transparency = 1
    char["Left Leg"].Transparency = 1
    char["Right Arm"].Transparency = 1
    char["Right Leg"].Transparency = 1
    wait(2)
    char.Head.Transparency = 0
    char.Head.Face.Transparency = 0
    char.Torso.Transparency = 0
    char["Left Arm"].Transparency = 0
    char["Left Leg"].Transparency = 0
    char["Right Arm"].Transparency = 0
    char["Right Leg"].Transparency = 0
end)

The script is in the text button when I click, it make me invisible, but my friend said that i have not invisible yet

2 answers

Log in to vote
1
Answered by 6 years ago

It may be because Filtering is Enabled, meaning whatever change you make on your client, doesn't replicate to the server. Filtering wiki page To work around this, use RemoteEvents! Remote Event wiki page

Ad
Log in to vote
0
Answered by 6 years ago

The client cannot directly change part properties as this would lead to exploiting. You would have to fire a remote event to the server where it would change the transparency of the parts.

Remote Events Tutorial

Also you should consider looking into for loops instead of typing each body part individually.

Something like this should get you going in the right direction, though I haven't tested the code.

--Server

local event = game.ReplicatedStorage.EVENTNAME

event.OnServerEvent:Connect(function(player)
    local character = player.Character or workspace:FindFirstChild(player.Name)
    for k, v in pairs(character:GetChildren()) do
        if v:IsA('BasePart') then
            v.Transparency = 1
            local decal = v:FindFirstChild('Decal')
            if decal then
                decal.Transparency = 1
            end
        end
    end
end)

Client:

local event = game.ReplicatedStorage.EVENTNAME

script.Parent.MouseButton1Down:Connect(function()
    event:FireServer(game.Players.LocalPlayer)
end)
0
Is this any different than what I just said? Void_Frost 571 — 6y
0
he included code, thats all Gey4Jesus69 2705 — 6y
0
:FireServer() has no required arguments. OnServerEvent automatically returns the player that fired the remote as a parameter. Therefore, your argument in the local script is not being used Gey4Jesus69 2705 — 6y

Answer this question