Pooglies
(Pooglies)
July 13, 2019, 7:55pm
#1
I have this script that should change a decal if the value in the moneyvalue is a certain number, but it does not work, any help?
script.Parent.Equipped:Connect(function()
if script.Parent.MoneyValue.Value == 1 then
script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=7994761"
script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=7994777"
elseif script.Parent.MoneyValue.Value == 2 then
script.Parent.Handle.Decal1.Texture = "http://www.roblox.com/asset/?id=12424991"
script.Parent.Handle.Decal.Texture = "http://www.roblox.com/asset/?id=12425000"
end
end)
1 Like
I think you need to use rbxasset not the weblink
“rbxassetid://numbershere”
Otherwise it could be a loading issue which you can use PreloadAsync for
Pooglies
(Pooglies)
July 13, 2019, 8:24pm
#3
I tried rbxasset, and it didn’t work, and theres no preload error.
I tried that exact piece of code you provided in my game and it changed the decal without any problems, I think there’s a different problem with your code. Try adding prints along it to see if it’s even reaching that.
1 Like
Pooglies
(Pooglies)
July 13, 2019, 8:52pm
#5
Did you use a local or server script.
Server but I’m sure it works with a local to
Pooglies
(Pooglies)
July 13, 2019, 8:52pm
#7
I used server to, I dont know why this doesn’t work.
I recreated it and it works perfectly fine for me, here’s the model file if you want my version. MoneyTool.rbxm (3.4 KB)
Pooglies
(Pooglies)
July 13, 2019, 8:59pm
#9
Alright I will test this. Let me try.
Pooglies
(Pooglies)
July 13, 2019, 9:01pm
#10
Its not working for me, when I change the value in properties and equip it again, its still 1 doller.
iGottic
(iGottic)
July 13, 2019, 9:01pm
#11
I know exactly why. The asset ID of a decal seems to change when I put it in a decal instance, and it works. Put the number part of it inside an image or decal, then copy the formatted code back into you code. Hope it works!
If you’re changing it directly in play mode on the client, you’re only changing the value locally. Click server next to the play button
1 Like
Pooglies
(Pooglies)
July 13, 2019, 9:10pm
#13
Well I need it to change instantly.
script.Parent.Equipped:Connect(function()
if script.Parent.MoneyValue.Value == 1 then
script.Parent.Handle.Decal1.Texture = "rbxassetid://7994761"
script.Parent.Handle.Decal.Texture = "rbxassetid://7994777"
elseif script.Parent.MoneyValue.Value == 2 then
script.Parent.Handle.Decal1.Texture = "rbxassetid://12424991"
script.Parent.Handle.Decal.Texture = "rbxassetid://12425000"
end
end)
Try this out first, and make sure ‘MoneyValue’ is an IntValue or a NumberValue I tested it, it’s working fine for me?
Pooglies
(Pooglies)
July 13, 2019, 9:50pm
#15
I dont know why its not working for me
Pooglies
(Pooglies)
July 13, 2019, 9:51pm
#16
Well, actually, so it works as, I have this gui you put a number into. If you put 2, it gives you that money tool, and I want it to change the decal like that, if this helps at all?
Pooglies
(Pooglies)
July 13, 2019, 9:54pm
#17
And basically, the started value is 0, meaning it only gets changed to 2 or 1, if the player types that.
Pooglies
(Pooglies)
July 13, 2019, 9:56pm
#18
Okay so what I think is wrong is the part where it gives the value to the tool, its client, so im going to make it server.
Ah so, You’re using a textbox to change the value? I think that’s the problem. Maybe try setting the Value to 1 or 2 and test if it works. It should, I think the textbox is the issue here.
For the client to communicate to the server you use remote events
Pooglies
(Pooglies)
July 13, 2019, 10:23pm
#20
Yes, I made a new post asking how to make it client and server sided.