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..
01 | script.Parent.MouseButton 1 Click:Connect( function () --on Player Click Buy.. |
02 | local player = script.Parent.Parent.Parent.Parent.Parent --player |
03 | --//Variables//-- |
04 | local gui = player.PlayerGui --gui |
05 | local Rgui = gui.RebirthGui --Rgui |
06 | local data = player.Data --data |
07 | local money = data.Money.Value --money |
08 | local rcoins = data.rcoins.Value --rcoins |
09 | local me = script.Parent |
10 | local roud = me.TextButton_Roundify_ 12 px |
11 | local prize = script.Parent.Parent.Parent.prize.Value |
12 | local frame = me.Parent |
13 | local notEnoughCoins = frame.notEnoughCins |
14 | local transfer = frame.transfer |
15 | local hrac = game.Workspace [ player.Name ] |
A couple of things you need to correct:
1 | local property = Instance.Name |
2 | property = “NewName” |
3 | print (Instance.Name = = “NewName”) --> false, the actual property doesn’t change |
4 | Instance.Name = “NewName” |
5 | 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