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

[SOLVED]Value in workspace wont set to what I tell it to?

Asked by
soutpansa 120
5 years ago
Edited 5 years ago

--The reason that the script would not work is because the QueCountdown was getting to -1 because i was changing it manually right before it ticked down. I made a loop that fixes this error and it works now. Thanks for reading

This loop is supposed to set "workspace.Winner.Value" to another value that is in the workspace. Everything in the loop works up until the line that sets its value. (workspace.Winner.Value = Entry.Name)

any idea why it wont work?

function HowManyPlayers()
    local NumberOfParts = workspace.Roster:GetChildren()
    return #NumberOfParts
end

while true do
    wait()
    if HowManyPlayers(workspace.Roster) == 1 and workspace.Winner.Value == "" and workspace.QueCountdown.Value == 0 then
            workspace.TourneyTime.Value = 20
            workspace.TourneyTime.Countdown.Disabled = false
            workspace.QueCountdown.Value = 2
            workspace.QueCountdown.Countdown.Disabled = false
            local Entry = workspace.Roster:FindFirstChild(Player.Name)
            if Entry ~= nil then
            workspace.Winner.Value = Entry.Name
            local Message = Instance.new("Message")
            Message.Parent = workspace
            Message.Text = ""..workspace.Winner.Value.." Has Won the Tourney. Glory to their house!"
            local Rekt = workspace.RemoveMessageScript:Clone()
            Rekt.Parent = Message
            Rekt.Disabled = false
            local Reward = math.random(1,5000)
            if Reward ~= 5000 and Player.Name == workspace.Winner.Value then
                Player.Stats.Money.Value = Player.Stats.Money.Value + 1000
                Player.Character.Humanoid.Health = 0
            elseif Reward == 5000 and Player.Name == workspace.Winner.Value then
                print("Mini Punches")
                Player.Character.Humanoid.Health = 0
            end         
        end
    end
end

thanks for reading

0
Messages are deprecated User#19524 175 — 5y
0
You aren't helping me at all with my question. This is the second time that you've left this unhelpful comment on a question of mine. I never said that I was going to use this message forever, and even if it is deprecated, It isn't a big deal if it ever breaks since it's easy to fix with a gui. I'd like some real help, please. I do appreciate your concern. soutpansa 120 — 5y
0
Any output? radusavin366 617 — 5y

1 answer

Log in to vote
-1
Answered by
Mr_Unlucky 1085 Moderation Voter
5 years ago

Make sure it's a string value. Otherwise, it won't work.

0
It is a string value soutpansa 120 — 5y
Ad

Answer this question