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

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

Asked by 2 years ago

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)

01local a = game.ReplicatedStorage["Finish Game"]
02local b = game:GetService('Players').LocalPlayer.PlayerGui
03local c = game:GetService('Players').LocalPlayer
04 
05 
06a.OnClientEvent:Connect(function()
07    b.Ending.Enabled = true
08    for i = 1, 4 do
09    b.Ending.Frame.BackgroundTransparency -= .25
10    b.Ending.Frame.ImageLabel.ImageTransparency -= .25
11    b.Ending.Frame.ImageLabel.UIStroke.Transparency -= .25
12    b.Ending.Frame.TextLabel.TextTransparency -= .25
13    b.Ending.Frame.TextLabel.UIStroke.Transparency -= .25
14    wait(.1)
15    end
16 
17    wait(10)
18    c:Kick("Thank You For Playing")
19end)
0
I updated my post theking66hayday 841 — 2y

3 answers

Log in to vote
1
Answered by 2 years ago
Edited 2 years 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.

01local a = game.ReplicatedStorage["Finish Game"]
02local b = game.Players.LocalPlayer.PlayerGui
03local c = game.Players.LocalPlayer
04print("Local Fine")
05 
06a.OnClientEvent:Connect(function()
07print("Got Event")
08    b.Ending.Enabled = true
09    for i = 1, 4 do
10print("Transparency")
11    b.Ending.Frame.BackgroundTransparency -= .25 --maybe try changing + to -
12    b.Ending.Frame.ImageLabel.ImageTransparency -= .25
13    b.Ending.Frame.ImageLabel.UIStroke.Transparency -= .25
14    b.Ending.Frame.TextLabel.TextTransparency -= .25
15    b.Ending.Frame.TextLabel.UIStroke.Transparency -= .25
View all 22 lines...

Hope this helps!!

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

1part.Touched:Connect(function(hit)
2    local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
3    if player then
4game.ReplicatedStorage.RemoteEvent:FireClient(player)
5 
6    end
7end)
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 — 2y
0
Updated my post see if that helps theking66hayday 841 — 2y
Ad
Log in to vote
0
Answered by 2 years ago

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 — 2y
0
currently writing a solution to this, give me a moment lol allybally12345 40 — 2y
Log in to vote
0
Answered by 2 years ago
01local event = game.ReplicatedStorage["Finish Game"] --most likely the remote event
02local plr = game:GetService('Players').LocalPlayer --the player
03local playergui = game:GetService('Players').LocalPlayer.PlayerGui --player gui
04event.OnClientEvent:Connect(function()
05    playergui.Ending.Enabled = true
06    for i = 1, 4 do
07            playergui.Ending.Frame.BackgroundTransparency += .25
08        playergui.Ending.Frame.ImageLabel.ImageTransparency += .25
09            playergui.Ending.Frame.ImageLabel.UIStroke.Transparency += .25
10            playergui.Ending.Frame.TextLabel.TextTransparency += .25
11        playergui.Ending.Frame.TextLabel.UIStroke.Transparency += .25
12        task.wait(.1)
13    end
14 
15    --now, instead of kicking through the client, we will kick through the script that sent this remote, as seen below
16end)
1--everything that comes before this event is fired
2game.ReplicatedStorage["Finish Game"]:FireAllClients() --fires for every player
3task.wait(10.4) --time that it would usually take
4for index,player in pairs(game.Players:GetPlayers()) do --loop through every player
5    -- we will only be using player
6    player:Kick("Thank you for playing!")
7end

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 — 2y
0
put it in startercharacterscripts, or starterplayerscripts allybally12345 40 — 2y

Answer this question