I'm trying to do a quest system and get 5 cash if I finish it

local frame1 = script.Parent
local frame = script.Parent.Parent.Frame
local talksound = script.Parent.Parent.TalkSound
local clicksound = script.Parent.Parent.ClickSound
local accept = script.Parent.Parent.Frame.Accept
local deny = script.Parent.Parent.Frame.Deny
local accept2 = script.Parent.Parent.Frame.Accept2
local deny2 = script.Parent.Parent.Frame.Deny2
local deny3 = script.Parent.Parent.Frame.Deny3
local player = game:GetService('Players').PlayerAdded

while (1) do
wait(1)
	if script.Parent.Value.Value == 5 then
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 5
	wait(2)
	frame1:TweenPosition(UDim2.new(-1, 0,0, 0))
	wait(1)
deny3.Visible = true
		deny3.Active = true
		accept.Visible = false
	accept.Active = false
	accept2.Visible = false
	accept2.Active = false
	deny.Visible = false
	deny.Active = false
	deny2.Visible = false
	deny2.Active = false
	wait(1)
		UI.Visible = true
	frame:TweenPosition(UDim2.new(0, 0,0.85, 0))
	wait(0.5)
		local text = "Thanks so much!"
		for i = 1, #text do
			frame.TextLabel.Text = string.sub(text, 1, i)

			talksound:Play()
	wait(0.1)
	script.Parent.Value.Value = 0
		   script.Parent.Parent.LocalScript.Disabled = false
	end
	end
	end

Normal script in ServerScriptService

game.Players.PlayerAdded:connect(function(plr)
 local stats = Instance.new("Folder", plr)
 stats.Name = "leaderstats"

 local cash = Instance.new("IntValue", stats)
 cash.Name = "Cash"
end)

5 comments

0

Are you sure 'player' is properly defined?

0

I've edited it

0

'local player = game:GetService('Players').PlayerAdded' should be 'local player = game:GetService('Players').PlayerAdded:Wait()'

0

Nothing happened

0

?