here is my script and i wanna remove the text and only have it display an image of the pet i got.
local plr = game.Players.LocalPlayer
local open = plr:WaitForChild('OpenValue')
while wait(0.1) do
if open.Value == "Open" then
wait(.2)
script.Parent.Visible = true
wait(.2)
script.Parent.Rotation = 3
script.tic:Play()
wait(.2)
script.Parent.Rotation = -3
script.tic:Play()
wait(.2)
script.Parent.Rotation = 3
script.tic:Play()
wait(.2)
script.Parent.Rotation = -3
script.tic:Play()
wait(.2)
script.Parent.Rotation = 4
script.tic:Play()
wait(.2)
script.Parent.Rotation = -4
script.tic:Play()
wait(.2)
script.Parent.Rotation = 5
script.tic:Play()
wait(.2)
script.Parent.Rotation = -5
script.tic:Play()
wait(.2)
wait(.2)
script.Parent.Rotation = 6
script.tic:Play()
wait(.2)
script.Parent.Rotation = -6
script.tic:Play()
wait(.2)
script.Parent.Rotation = 1
script.Open:Play()
wait(.1)
script.Parent.Visible = false
wait(.1)
script.Parent.Parent.Pet.Visible = true
script.Parent.Parent.Pet.Text = "You got "..plr.GotPet.Value.." !"
wait(2)
script.Parent.Parent.Pet.Visible = false
end
end
Edit: If this is what you mean by where plr.gotpet is stored then its in my leaderstats:
game.StarterGui.ResetPlayerGuiOnSpawn = false
local DataStoreService = game:GetService("DataStoreService")
local playerData = DataStoreService:GetDataStore("PlayerData")
game.Players.PlayerAdded:connect(function(Player)
local leaderstats = Instance.new("Folder", Player)
leaderstats.Name = "leaderstats"
local val1 = Instance.new("StringValue",Player)
val1.Name = 'GotPet'
val1.Value = ''
local val2 = Instance.new("StringValue",Player)
val2.Name = 'OpenValue'
val2.Value = ''
local Gems = Instance.new("IntValue", leaderstats)
Gems.Name = "Gems"
Gems.Value = 0
local Rebirths = Instance.new("IntValue", leaderstats)
Rebirths.Name = "Rebirths"
Rebirths.Value = 0
local Coins = Instance.new("IntValue", leaderstats)
Coins.Name = "Coins"
Coins.Value = 0
local playerUserId = "Player_" .. Player.UserId --Gets player ID
local Success, Result = pcall(function()
return playerData:GetAsync(playerUserId)
end)
if Result then
print("Data found!")
Coins.Value = Result[1] -- // Since in the saving part, Coins are the one that is set as the first value of the table, we set Coins as [1]
Rebirths.Value = Result[2]
Gems.Value = Result[3]
else
print("DataStore working but No data found")
warn(Result)
end
end)
local function onPlayerExit(player) --Runs when players exit
local success, Err = pcall(function()
print("Data Saved successfully")
local playerUserId = "Player_" .. player.UserId
playerData:SetAsync(playerUserId, {player.leaderstats.Coins.Value, player.leaderstats.Rebirths.Value, player.leaderstats.Gems.Value}) -- Now set as a table instead of individually
end)
if not success then
warn(Err)
warn('Could not save data!')
end
end
game.Players.PlayerRemoving:Connect(onPlayerExit)
and here is where the pet is chosen
local userInputService = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")
local Eggs = require(RS:WaitForChild("Eggs"))
local Data = Eggs[script.Name]
local Cost = Data["Cost"]
local Pets = Data["Pets"]
local Buy = game.Workspace.Eggs.Common
local Cost1 = Buy:WaitForChild("Cost")
local CD = Buy.Buy.Select:WaitForChild("ImageButton")
local CostGUI = Cost1:WaitForChild("Am")
local CostText = CostGUI:WaitForChild("TextLabel")
CostText.Text = Cost.." Coins"
local TotalWeight = 0
for i,v in pairs(Pets) do
TotalWeight = TotalWeight + v[1]
end
local function ChoosePet()
local Chance = math.random(1,TotalWeight)
local Counter = 0
for i,v in pairs(Pets) do
Counter = Counter+v[1]
if Chance <= Counter then
return i
end
end
end
CD.Triggered:Connect(function(Player)
local Stats = Player:WaitForChild("leaderstats")
local Coins = Stats:WaitForChild("Coins")
local open = Player:WaitForChild('OpenValue')
local got = Player:WaitForChild('GotPet')
if Coins.Value >= Cost then
Coins.Value = Coins.Value - Cost
open.Value = 'Open'
got.Value = ChoosePet()
local findpet = Player:WaitForChild('Pets')
local sqq = findpet:FindFirstChild(got.Value)
sqq.Value = 'owned'
wait(5)
open.Value = 'Close'
got.Value = ''
end
end) -- // this code has an error on CD.Triggered i know. but im fixing that soon.
I dont have the images store anywhere currently as i dont know exactly where to store them.

3 comments
Where do you set plr.GotPet? Do you have the image of the pet saved somewhere?
Is script.Parent.Parent.Pet a Gui element? Is that where you want the image?
indeed