This script is inside the player's "Rebirth Gui", but it doesn't work .. The problem is probably inside the condition, but where ?! Please help..
script.Parent.MouseButton1Click:Connect(function() --on Player Click Buy.. local player = script.Parent.Parent.Parent.Parent.Parent --player --//Variables//-- local gui = player.PlayerGui--gui local Rgui = gui.RebirthGui--Rgui local data = player.Data --data local money = data.Money.Value --money local rcoins = data.rcoins.Value --rcoins local me =script.Parent local roud = me.TextButton_Roundify_12px local prize = script.Parent.Parent.Parent.prize.Value local frame = me.Parent local notEnoughCoins = frame.notEnoughCins local transfer = frame.transfer local hrac = game.Workspace[player.Name] local head = hrac:WaitForChild("Head") local howMuch = script.Parent.Parent.Parent.howMuch.Value --local buySound = head:WaitForChild("buySound") --Add sounds soon.... --/SCRIPT/-- if money > prize then money = (money - prize) rcoins = rcoins + (howMuch * 1800) end end) --End
A couple of things you need to correct:
local property = Instance.Name property = “NewName” print(Instance.Name == “NewName”) --> false, the actual property doesn’t change Instance.Name = “NewName” print(Instance.Name == “NewName”) --> true, it has changed now
Changes made by clients do not replicate to the server. You must use remotes to initiate changes from client to server.
The local player can be referred to simply as game.Players.LocalPlayer, the extensive usage of .Parent is unnecessary and cluttering.
See also: Handling properties: https://developer.roblox.com/en-us/videos/Intro-to-Scripting-Changing-Properties Learning about replication: https://developer.roblox.com/en-us/api-reference/property/Workspace/FilteringEnabled