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

Script doesn't want to change a surfacegui?

Asked by 7 years ago

I'm working on an F.E. game, a script I'm using is supposed to change values and things... Although most of it works well, there is one line that just doesn't seem to be working for no reason.

script.Parent.OnServerEvent:connect(function(player, Player, Side)
    script.Parent.Parent[Side].PZone.Player.Value = Player.Name
    game.Workspace[Player.Name].Humanoid.WalkSpeed = 0 -- To stop character walk animation
    game.Workspace[Player.Name].Humanoid.JumpPower = 0
    wait(0.2)
    game.Workspace[Player.Name].Torso.Anchored = true
    game.Workspace[Player.Name].Humanoid.WalkSpeed = 16
    game.Workspace[Player.Name].Humanoid.JumpPower = 50
    if script.Parent.Parent.Red.PZone.Player.Value == "None" or script.Parent.Parent.Blue.PZone.Player.Value == "None" then
        game.Players[Player.Name].Wait:FireClient(player)
        repeat
            wait()
        until script.Parent.Parent.Blue.PZone.Player.Value ~= "None" and script.Parent.Parent.Red.PZone.Player.Value ~= "None" -- wait until there are two players
    end
    script.Parent.Parent[Side].FoeLP.Background.LifePoints.LifeLeft.Text = "8000" --Problem line
    script.Parent.Parent[Side].YourLP.Background.LifePoints.LifeLeft.Text = "8000" -- exact same thing but works fine
    script.Parent.Parent[Side].Deck.SurfaceGui.ImageLabel.Visible = true
    script.Parent.Parent[Side].Deck.SurfaceGui.TextLabel.Text = #(game.Players[player.Name].Cards.Deck:GetChildren())
    script.Parent.Parent[Side].Extra.SurfaceGui.TextLabel.Text = #(game.Players[player.Name].Cards.Extra:GetChildren())
    script.Parent.Parent[Side].Extra.SurfaceGui.ImageLabel.Visible = true
    script.Parent.Parent[Side].Graveyard.SurfaceGui.ImageLabel.Visible = true
    script.Parent.Parent[Side].Graveyard.SurfaceGui.TextLabel.Text = "0"
end)

I put --Problem line where the problem is, the following line does the exact same thing to the other part, and aside from the name being FoeLP instead of YourLP, they are identical in every way, yet it doesn't want to show the text I change it to in the script. I tried changing it before I clicked play, see if it wasn't showing correctly, but it worked. Other thing is, the text in the surface gui changes, but it doesn't show the actual text on the part... I am stumped on this, can anybody help?

0
Note: Works on test mode but not play mode...? DivineObliteration 9 — 7y
0
My guess would be that an item(s) may not have loaded at the time of execution; please check the Output server, as it may return the error. (You can access the Output server by pressing F9 on your keyboard; this'll help to further diagnose the problem, and would confirm my assumption if it says "tried to get a nil value," or something along those lines.) TheeDeathCaster 2368 — 7y
0
It shows nothing on client log and server log during solo play, and as I've written above, it works fine in test mode... How odd, usually it's the other way around for me. lol DivineObliteration 9 — 7y

Answer this question