It should do when it is activated spawn a object called soda,finding in the workspace a store with the username , and do a value change on Cash but when it is in game It doesnt do anything. I Tried to add it print to see if it atleast write want soda but dont! what can be the problem?
local price = 45 local Soda = game:GetService('ServerStorage').SodaDispenser local Owner = script.Parent.Parent.Parent.CurrentOwner.Value Clickdetector = script.Parent.ClickDetector script.Parent.ClickDetector.MouseClick:connect(function(player) if player:FindFirstChild("leaderstats") and Owner.Name == player.Name then print(player.Name..' has clicked the button.') local clone = Soda:Clone() clone.Parent = game.Workspace clone.Position = player['Character']['HumanoidRootPart'].Position+Vector3.new(0, 1, 0) Clickdetector.Parent.Parent.Parent["Buy a soda dispenser by 45 coins!"].Name = "Done" wait(1) Clickdetector.Parent.Parent.Parent.Done:Destroy() Clickdetector.Parent.Script:Destroy() wait(1) end end)