Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My script only works with leaderstats without giving the tool?

The script is meant to give the tool 'Drink' from replicated storage, but all what works is taking the currency 'Minutes' away without giving the tool. Have I made a mistake within my script? Have I done something wrong? I had to get this from a tutorial on youtube, and I'm not sure If I followed it correctly and I cannot find the issue. Thanks :)

local price = 12
local db = true

script.Parent.ClickDetector.MouseClick:connect(function(player)
	if player.leaderstats.Minutes.Value >= price then
		player.leaderstats.Minutes.Value = player.leaderstats.Minutes.Value - price
		db = false
		script.Parent.BrickColor.new("Bright red")
		game.ReplicatedStorage.Drink:Clone().Parent = player.Backpack
		wait (3)
		script.Parent.BrickColor = BrickColor.new("Bright green")
		db = true
	end
end)

3 comments

0

aaaaa, I can't tell if I've made any mistakes within the typing- I have mild dyslexia :/

0

your typing is fine

0

yes because I have to read through it before i made sure its alright.

2 answers

✓ Accepted answer

Try remove this line: script.Parent.BrickColor.new("Bright red")

If this doesn't work, please tell me the error in output.

Change the bright red color line to the script below.

script.Parent.BrickColor = BrickColor.new("Bright red")

This discussion is preserved as it was. New answers, comments, and votes are closed.