ok i get it now, but it wont work when i print in the same script look:
it wont work when i print in the same script look:
Make sure you put it near where itâs erroring.
idk why but it did nothing:
Put it right before the part where it errors (Before the first if statement)
still nothing:
Send the full output, it shouldâve printed something. What I sent wasnât a fix, it was just a debug code.
i had a look but it still didnât print anything
Run it again and send everything from the output in a code block here.
this is it, but when i hold e it gets the output:
Is it not showing anything else on the output?
Something along the lines of number string
?
ah yes i forgot this part:
also EggServer is the name of the script
Can you go to the script where the value of gems is being sent and show me what it looks like?
i think this bit:
The leaderstats script not the egg script
oh ok
the module script:
Not the module script the leaderstats script (the script where you have your leaderstats set up)
the data script for my leaderstats that has nothing to do with the eggs:
local StatsName = "Gems" -- Enter your Stats Name (Current is "Cash")
local StartingAmt = 10000 -- 10,000 Cash on Playing Game
local DataStoreService = game:GetService("DataStoreService")
local RunService = game:GetService("RunService")
local PlayersService = game:GetService("Players")
local statsStore = DataStoreService:GetDataStore("-stats")
---------------------
game.Players.PlayerAdded:Connect(function(Player)
local leaderFolder = Player:WaitForChild("leaderstats")
local statsValue = Instance.new("StringValue")
statsValue.Value = StartingAmt
statsValue.Name = StatsName
statsValue.Parent = leaderFolder
local lastEquipped = Instance.new("StringValue")
lastEquipped.Value = "nil"
lastEquipped.Parent = Player
lastEquipped.Name = "equippedTrail"
local oldData
local foundData,newplr = pcall(function()
oldData = statsStore:GetAsync(Player.UserId)
end)
if foundData and oldData ~= nil then
statsValue.Value = oldData.Stat
lastEquipped.Value = oldData.equip
end
end)
game.Players.PlayerRemoving:Connect(function(Player)
local succesSaved,ErrorSaved = pcall(function()
statsStore:SetAsync(Player.UserId,{
Stat = Player.leaderstats:FindFirstChild(StatsName).Value,
equip = Player.equippedTrail.Value,
})
end)
end)
game:BindToClose(function()
if RunService:IsStudio() then
wait(1)
else
for _, Player in pairs(PlayersService) do
local succesSaved,ErrorSaved = pcall(function()
statsStore:SetAsync(Player.UserId,{
Stat = Player.leaderstats:FindFirstChild(StatsName).Value,
equip = Player.equippedTrail.Value
})
end)
end
end
end)
----- // The Below Part is Used for Trail Remove Events
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local REEvent = ReplicatedStorage:FindFirstChild("trailShopRE")
REEvent.OnServerEvent:Connect(function(Player,TrailName,TrailColour,state)
if state == "equip" and Player.Character then
local success,errormsg = pcall(function()
local HRP = Player.Character.HumanoidRootPart
for i, oldTrail in pairs(HRP:GetChildren()) do
if oldTrail:IsA('Trail') or oldTrail.Name == "trailAttachment" then
oldTrail:Destroy()
end
end
for i, oldTrail in pairs(Player.Character.Head:GetChildren()) do
if oldTrail:IsA('Trail') or oldTrail.Name == "trailAttachment" then
oldTrail:Destroy()
end
end
-- local r, g, b = R, G, B
-- local strOne = string.format("%0.f", r*255)
-- local strTwo = string.format("%0.f", g*255)
-- local strThree = string.format("%0.f", b*255)
-- print(strOne .. " " .. strTwo .. " " .. strThree)
-- local Finalcolour = Color3.new(strOne,strTwo,strThree)
local newTrail = Instance.new("Trail")
newTrail.Name = TrailName
newTrail.Color = TrailColour
newTrail.Parent = HRP
newTrail.MaxLength = 10
local attachmentOne = Instance.new("Attachment")
attachmentOne.Name = "trailAttachment"
attachmentOne.Parent = HRP
local attachmentTwo = Instance.new("Attachment")
attachmentTwo.Name = "trailAttachment"
attachmentTwo.Parent = Player.Character.Head
newTrail.Attachment0 = attachmentOne
newTrail.Attachment1 = attachmentTwo
Player.equippedTrail.Value = TrailName
end)
if not success then
warn(errormsg)
end
end
end)
REEvent.OnServerEvent:Connect(function(Player,TrailName,state)
if state == 'unequip' then
if Player.Character then
local unequipped,stillEquipped = pcall(function()
local HRP = Player.Character.HumanoidRootPart
for i, oldTrail in pairs(HRP:GetChildren()) do
if oldTrail:IsA('Trail') or oldTrail.Name == "trailAttachment" then
oldTrail:Destroy()
end
end
for i, oldTrail in pairs(Player.Character.Head:GetChildren()) do
if oldTrail:IsA('Trail') or oldTrail.Name == "trailAttachment" then
oldTrail:Destroy()
end
end
Player.equippedTrail.Value = "nil"
end)
if not unequipped then
warn(stillEquipped)
end
end
end
end)
REEvent.OnServerEvent:Connect(function(Player,Price,TrailName,state)
if state == "purchase" then
local check,errored = pcall(function()
if Player.leaderstats:FindFirstChild(StatsName).Value >= Price then
Player.leaderstats:FindFirstChild(StatsName).Value -= Price
REEvent:FireClient(Player,"purchaseSuccess",TrailName)
local newValue = Instance.new("BoolValue")
newValue.Name = TrailName
newValue.Value = true
newValue.Parent = Player.trailsOwned
end
end)
if not check then
warn(errored)
end
end
end)
this is the whole leaderstats script for the gems
change statsValue to a IntValue instead of a StringValue
local statsValue = Instance.new("IntValue")
oh yeah i changed it before i sent it to u