yurhomi10
|
  |
| Joined: 10 Dec 2008 |
| Total Posts: 13886 |
|
|
| 10 Apr 2014 06:18 PM |
-- the whole purpose of this script, is so that when a player touches either red or green brick, it will update the color that was set to the player.
local data = game:GetService("DataStoreService") local color = data:GetDataStore("Color")
touched = false
game.Players.PlayerAdded:connect(function(p) --getting the stored data getcolor = color:GetAsync("User_" .. p.userId) or "No color yet" while getcolor do wait() print(color) if getcolor == "No color yet" then game.Workspace.Display.BrickColor = BrickColor.new("White") elseif getcolor == "Green" then game.Workspace.Display.BrickColor = BrickColor.new("Lime green") elseif getcolor == "Red" then game.Workspace.Display.BrickColor = BrickColor.new("Really red") else print("what the heck is wrong?") end end
game.Green.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if touched == false then touched = true color:SetAsync("User_" .. player.userId, "Green") print("Currently in the Touched event for green .. ") wait(1) touched = false end end) game.Red.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if touched == false then touched = true color:SetAsync("User_" .. player.userId, "Red") print("Currently in the Touched event for red .. ") wait(1) touched = false end end) end) |
|
|
| Report Abuse |
|
|
| |
|
yurhomi10
|
  |
| Joined: 10 Dec 2008 |
| Total Posts: 13886 |
|
|
| 10 Apr 2014 06:20 PM |
| well, even when i touch the brick, it doesnt update the value... |
|
|
| Report Abuse |
|
|
yurhomi10
|
  |
| Joined: 10 Dec 2008 |
| Total Posts: 13886 |
|
|
| 10 Apr 2014 06:21 PM |
| wait, im stupid.. I said 'color' instead of 'getcolor' |
|
|
| Report Abuse |
|
|
TomsGames
|
  |
| Joined: 11 Oct 2013 |
| Total Posts: 1615 |
|
|
| 10 Apr 2014 06:25 PM |
local data = game:GetService("DataStoreService") local color = data:GetDataStore("Color")
touched = false
game.Players.PlayerAdded:connect(function(p) --getting the stored data getcolor = color:GetAsync("User_" .. p.userId) or "No color yet" while getcolor do wait() print(color) if getcolor == "No color yet" then game.Workspace.Display.BrickColor = BrickColor.new("White") elseif getcolor == "Green" then game.Workspace.Display.BrickColor = BrickColor.new("Lime green") elseif getcolor == "Red" then game.Workspace.Display.BrickColor = BrickColor.new("Really red") else print("what the heck is wrong?") end
end
game.Workspace.Green.Touched:connect(function(hit) -- You forgot to add "Workspace" local player = game.Players:GetPlayerFromCharacter(hit.Parent) if touched == false then touched = true color:SetAsync("User_" .. player.userId, "Green") print("Currently in the Touched event for green .. ") wait(1) touched = false end end) game.Red.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if touched == false then touched = true color:SetAsync("User_" .. player.userId, "Red") print("Currently in the Touched event for red .. ") wait(1) touched = false end end) end) |
|
|
| Report Abuse |
|
|
TomsGames
|
  |
| Joined: 11 Oct 2013 |
| Total Posts: 1615 |
|
|
| 10 Apr 2014 06:26 PM |
| Same for the third function. Add "game.Workspace.Red" |
|
|
| Report Abuse |
|
|
yurhomi10
|
  |
| Joined: 10 Dec 2008 |
| Total Posts: 13886 |
|
|
| 10 Apr 2014 06:28 PM |
| Haven't tested it yet, but still very thankful for pointing it out! |
|
|
| Report Abuse |
|
|