jcpd910
|
  |
| Joined: 18 Jul 2011 |
| Total Posts: 70 |
|
|
| 03 Mar 2015 10:07 PM |
The following script works as intended in Studio test mode, but it won't work online.
Shirt = script.Parent.Parent.Shirt ItemID = script.Parent.Parent.Shirtid.Value Shirt.ShirtTemplate = ItemID Cost = script.Parent.Parent.ShirtCost.Value ItemName = script.Parent.Parent.ShirtItem.Value
script.Parent.Parent.Name = ""
local clickDetector = Instance.new("ClickDetector", script.Parent) clickDetector.Name = "clicker"
script.Parent.clicker.MouseHoverEnter:connect(function(Player) script.Parent.Parent.Name = ItemName..": $"..Cost end)
script.Parent.clicker.MouseHoverLeave:connect(function(Player) script.Parent.Parent.Name = "" end)
local function onMouseClick(player) if player.leaderstats.Money.Value >= Cost then local Player = player repeat wait() until Player.Character local Char = Player.Character if Char.shirt.ShirtTemplate ~= ItemID then player.leaderstats.Money.Value = player.leaderstats.Money.Value - Cost Char.shirt.ShirtTemplate = ItemID end end end clickDetector.MouseClick:connect(onMouseClick)
When in studio, it changes the player's shirt. When in online mode, all it does is deduct money. A few of my friends have noticed that when they rejoin, they see anyone who bought the shirt as someone who is wearing it, but the shirts don't register until someone restarts.\
How do I fix this glitch? |
|
|
| Report Abuse |
|
|
jcpd910
|
  |
| Joined: 18 Jul 2011 |
| Total Posts: 70 |
|
| |
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 04 Mar 2015 04:56 AM |
Well you're coding it like it's a local script... Also what if the player doesn't have a shirt on it'll break your script. :o You need to make it delete shirt if found and instance a new one. :P |
|
|
| Report Abuse |
|
|
jcpd910
|
  |
| Joined: 18 Jul 2011 |
| Total Posts: 70 |
|
|
| 04 Mar 2015 05:10 AM |
| I'm going to try that now. :) |
|
|
| Report Abuse |
|
|
jcpd910
|
  |
| Joined: 18 Jul 2011 |
| Total Posts: 70 |
|
| |
|
|
| 04 Mar 2015 05:17 AM |
| skimmed OP...and what...click detectors have a MouseClick event lol |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2015 05:17 AM |
| oh nvm didn't read that right |
|
|
| Report Abuse |
|
|
jcpd910
|
  |
| Joined: 18 Jul 2011 |
| Total Posts: 70 |
|
|
| 04 Mar 2015 05:20 AM |
| What's weird is that it works in Studio mode just fine. |
|
|
| Report Abuse |
|
|
jcpd910
|
  |
| Joined: 18 Jul 2011 |
| Total Posts: 70 |
|
|
| 04 Mar 2015 05:23 AM |
| Also, it appears that it does run the script, but when in the real game, it won't show you the updated clothes. If someone joins after you buy it, they see the new clothes, but for some reason the game is just not updating for any current player's. |
|
|
| Report Abuse |
|
|
jcpd910
|
  |
| Joined: 18 Jul 2011 |
| Total Posts: 70 |
|
|
| 04 Mar 2015 05:27 AM |
| It even works in build mode. |
|
|
| Report Abuse |
|
|
jcpd910
|
  |
| Joined: 18 Jul 2011 |
| Total Posts: 70 |
|
| |
|