Shouldn’t the script underline the last end statement in something if you are missing and end or a bracket? Just tried it and it does for me
1 Like
Oops that was a wrong reply, and also I just used a function lol
1 Like
I store it in another script, Im not getting the rarity variable but rather the text from the paper, Which is set to the rarity variable in another script.
I think this can solve your problem
game.Players.PlayerAdded:connect(function(p)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
stats.Parent = p
local money = Instance.new("IntValue")
money.Name = "Money"
money.Value = 10 -- You can change this to anything
money.Parent = stats
local Sell = game.Workspace.PlaceHolderSellPoint
local Handle = game.ReplicatedStorage.Paper.Handle
local Paper = Handle.Parent
local Rarity = Handle.Rarity
local function onPartTouched(Handle)
print((Sell.Name .. " has touched " .. Handle.Name))
if Rarity == "Common" then
Paper:Destroy()
p.leaderstats.Money.Value = 2+
Sell.Touched:Connect(onPartTouched)
elseif Rarity == "Common+" then
Paper:Destroy()
p.leaderstats.Money.Value = 10+
Sell.Touched:Connect(onPartTouched)
elseif Rarity == "Rare" then
Paper:Destroy()
p.leaderstats.Money.Value = 70+
Sell.Touched:Connect(onPartTouched)
elseif Rarity == "Rare+" then
Paper:Destroy()
p.leaderstats.Money.Value = 170+
Sell.Touched:Connect(onPartTouched)
elseif Rarity == "Epic" then
Paper:Destroy()
p.leaderstats.Money.Value = 500+
Sell.Touched:Connect(onPartTouched)
elseif Rarity == "Epic+" then
Paper:Destroy()
p.leaderstats.Money.Value = 1250+
Sell.Touched:Connect(onPartTouched)
elseif Rarity == "Legendary" then
Paper:Destroy()
p.leaderstats.Money.Value = 5000+
Sell.Touched:Connect(onPartTouched)
elseif Rarity == "Mythic" then
Paper:Destroy()
p.leaderstats.Money.Value = 30000+
Sell.Touched:Connect(onPartTouched)
end
end
end)
Reply me if it doesn’t works
I’d suggest having a separate script in the Handle that detects when it gets touched