Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

--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

3 comments

0

Messages are deprecated

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.

0

Any output?

1 answer

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

1 comment

0

It is a string value

This discussion is preserved as it was. New answers, comments, and votes are closed.