0

# :FireClient() Doesnt Change Transparency For Gui in PlayerGui?

what this script is supposed to do is that when the RemoteEvent is fired, the player who fired the scripts GUI (aka playergui) will change the transparency for the GUI by taking away -.25 for every GUI object listed in the script, once that repeated 4 times, the script will wait 10 seconds before kicking the player who fired it. but the script doesn't work, it doesn't change the gui's transparency or anything at all, if anyone could find a solution that would be great

Script (LocalScript)

local a = game.ReplicatedStorage["Finish Game"]
local b = game:GetService('Players').LocalPlayer.PlayerGui
local c = game:GetService('Players').LocalPlayer

a.OnClientEvent:Connect(function()
b.Ending.Enabled = true
for i = 1, 4 do
b.Ending.Frame.BackgroundTransparency -= .25
b.Ending.Frame.ImageLabel.ImageTransparency -= .25
b.Ending.Frame.ImageLabel.UIStroke.Transparency -= .25
b.Ending.Frame.TextLabel.TextTransparency -= .25
b.Ending.Frame.TextLabel.UIStroke.Transparency -= .25
wait(.1)
end

wait(10)
c:Kick("Thank You For Playing")
end)

0
I updated my post theking66hayday 836 — 28d

1
Edited 28 days ago

The only thing I can see that might be the problem is that you used - instead of + for the transparency part. I don't think that would cause the script to not work though So I fixed a few things. Like the local player part to :GetService I also added prints to try to narrow in on the problem. Let me know what prints are not being printed to narrow in on the issue.

local a = game.ReplicatedStorage["Finish Game"]
local b = game.Players.LocalPlayer.PlayerGui
local c = game.Players.LocalPlayer
print("Local Fine")

a.OnClientEvent:Connect(function()
print("Got Event")
b.Ending.Enabled = true
for i = 1, 4 do
print("Transparency")
b.Ending.Frame.BackgroundTransparency -= .25 --maybe try changing + to -
b.Ending.Frame.ImageLabel.ImageTransparency -= .25
b.Ending.Frame.ImageLabel.UIStroke.Transparency -= .25
b.Ending.Frame.TextLabel.TextTransparency -= .25
b.Ending.Frame.TextLabel.UIStroke.Transparency -= .25
wait(.1)
print("Done")
end

wait(10)
c:Kick("Thank You For Playing")
end)


Hope this helps!!

Updated You can get the player by doing something like this.

part.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
game.ReplicatedStorage.RemoteEvent:FireClient(player)

end
end)

0
ok so i think the problem is the actual script that fires the client (aka the script with FireClient(), you need to insert the player inside the brackets, do you know any way i can get the player that touches a part (not the player model, the actual player) JmoneyPlayzOfficial 49 — 28d
0
Updated my post see if that helps theking66hayday 836 — 28d
0

I think there is a problem in the for statement, however, I can't find out exactly yet.

0
i think its either with the "for" statement or something with the transparency JmoneyPlayzOfficial 49 — 29d
0
currently writing a solution to this, give me a moment lol allybally12345 40 — 27d
0
local event = game.ReplicatedStorage["Finish Game"] --most likely the remote event
local plr = game:GetService('Players').LocalPlayer --the player
local playergui = game:GetService('Players').LocalPlayer.PlayerGui --player gui
event.OnClientEvent:Connect(function()
playergui.Ending.Enabled = true
for i = 1, 4 do
playergui.Ending.Frame.BackgroundTransparency += .25
playergui.Ending.Frame.ImageLabel.ImageTransparency += .25
playergui.Ending.Frame.ImageLabel.UIStroke.Transparency += .25
playergui.Ending.Frame.TextLabel.TextTransparency += .25
playergui.Ending.Frame.TextLabel.UIStroke.Transparency += .25
end

--now, instead of kicking through the client, we will kick through the script that sent this remote, as seen below
end)

--everything that comes before this event is fired
game.ReplicatedStorage["Finish Game"]:FireAllClients() --fires for every player
task.wait(10.4) --time that it would usually take
for index,player in pairs(game.Players:GetPlayers()) do --loop through every player
-- we will only be using player
player:Kick("Thank you for playing!")
end


tell me if this doesnt work

0
i will try this answer soon, but where do i actually put the localscript because it doesnt work in workspace JmoneyPlayzOfficial 49 — 26d
0
put it in startercharacterscripts, or starterplayerscripts allybally12345 40 — 17d