Currently working on a simple tarot game where a button randomizes the image on the card, therefore I have an intvalue in my startergui that is to be randomized when a screengui button is pressed and that value is to determine the surfacegui on my cards.
My problem is that the value is changing whenever i press the button, but the script that is meant to change the image on the surfacegui is not connecting. Below are my scripts as well as a picture that shows my setup, I appreciate any help! <3
SurfaceGui
local img = script.Parent
local players = game:GetService("Players")
local player = players.LocalPlayer
local int = player.PlayerGui.Value.Value
local decal = img.Image
if int == 1 then
decal = "rbxassetid://81697930483293"
else if int ==2 then
decal = "rbxassetid://104833337657584"
elseif int == 3 then
decal = "rbxassetid://123665386939809"
elseif int == 4 then
decal = "rbxassetid://128538253864103"
elseif int == 5 then
decal = "rbxassetid://128085481266296"
elseif int == 6 then
decal = "rbxassetid://119606272234483"
elseif int == 7 then
decal = "rbxassetid://114203547574504"
elseif int == 8 then
decal = "rbxassetid://120782084649400"
elseif int == 9 then
decal = "rbxassetid://95733541959090"
elseif int == 10 then
decal = "rbxassetid://114599110596148"
end
end
Button
local button = script.Parent
local players = game:GetService("Players")
local player = players.LocalPlayer
local val = player.PlayerGui.Value
button.Activated:Connect(function()
val.Value = math.random(1,10)
end)