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

Whats wrong with this function? It doesn't change anything.

Asked by 5 years ago
Edited by User#24403 5 years ago

lua script.Parent.Touched:Connect(function() game.StarterGui.ScreenGui.Frame.BackgroundTransparency = 1 wait(5) game.StarterGui.ScreenGui.Frame.BackgroundTransparency = 0 end)

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

There are 2 things wrong with what you wrote:

You're changing the StarterGui which will only show changes in your UI when you reset, or join the game. You want to change the PlayerGui of the person who touched the brick (I'm guessing).

-- You probably would want to do something like this
player.PlayerGui.ScreenGui.OtherUiStuff

Assuming your script is on the Server Side, you cannot access the client's PlayerGui through a touch event since it is on the Client Side. You would need to use Remote Events or Functions to change anything on the Client Side.

part.Touched:Connect(function(obj)
    local char = obj.Parent
    if char:FindFirstChild("Humanoid") then
        remoteEvent:FireClient(game.Players:GetPlayerFromCharacter(char))
    end
end)
1
Thank you! User#27142 0 — 5y
0
By the way it'd be nice if you accepted his answer. farrizbb 465 — 5y
0
sry i was new to this site User#27142 0 — 5y
Ad

Answer this question