he does not specify that the money are removed and of course only the server can truly remove the money from the player,
Did you move the local script on StarterPlayerScript and Yes Seeing your video it look that is also requires an event that returns to the server for remove player cash, to get this 100% working you should actually connect to the server and then have the server send the response back to the client
My suggestion for you is to learn more About Sending remote events RemoteEvent | Roblox Creator Documentation and RemoteEvent | Roblox Creator Documentation so that you can make the system 100% Efficient
yea its in starter player scripts
Also I Notice that the Gui is Visible that means it’s a problem of the gui try to check if it’s enabled the instance DoorPurchase
on StarterGui
Enabled = true
yea… I might have figured it out tho
Yea… I didn’t…
local player = game.Players.LocalPlayer
local gui = game.StarterGui.DoorPurchase.Frame
local door = game.Workspace.Maps.Map1.Door
local ProximityPrompt = door.ProximityPrompt
ProximityPrompt.Triggered:Connect(function(player)
gui.Visible = true
end)
Still same problem, this is inside startplayerscripts
This will refer to the Frame within the original ScreenGui in the StarterGui
Service, meaning that when you set gui.Visible = true
, it’s not going to change the visbility of the Frame that the player sees.
When a player joins the game (along with respawning for ScreenGuis with ResetOnSpawn
set to true), any ScreenGuis in the StarterGui Service are parented to the player’s PlayerGui
folder (hierarchy is player Instance → PlayerGui).
Here’s an example of how that GUI and its Frame could be referenced:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local doorPurchaseGui = PlayerGui:WaitForChild("DoorPurchase")
local Frame = doorPurchaseGui:WaitForChild("Frame")
-- When referencing the doorPurchaseGui, make sure to check if it exists before indexing the Frame contained within it
-- For example:
if doorPurchaseGui and Frame then
Frame.Visible = true
-- Continue
end
local scripts dont work inside the workspace. Put it in StarterPlayerScripts and change the gui location from game.StarterGui to plr.PlayerGui
also change the door to workspace.Door and the prompt to workspace.Door.Prompt etc etc
local gui = player.PlayerGui.DoorPurchase.Frame
change the variable to this and it will work
I did all that and stuff, I do need to do plrgui I think that was it
local player = game.Players.LocalPlayer
local gui = player.PlayerGui.DoorPurchase.Frame
local door = game.Workspace.Maps.Map1.Door
local ProximityPrompt = door.ProximityPrompt
ProximityPrompt.Triggered:Connect(function(player)
gui.Visible = true
end)
Nope, now its just not making it visible. It is going to the right place… aaaaaaaaaaah
Learning FireServer and FireClient as @Sonostrano20 said would be better since it would make coding this system much much easier!
I will be doing it after this works
To make this work, it would be more advisable to use remote events.
no, that is trully unnecessary lol
Ok then, tell me how you would do it. It should be a door that when proximity prompt triggered, makes a UI visible and in the UI there will be Yes/No button. When yes clicked, money is deducted and the door is purchased.
local door = script.Parent
local prompt = door:WaitForChild("ProximityPrompt")
local price = 250
door.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
local leaderstats = plr:WaitForChild("leaderstats")
local cash = leaderstats:WaitForChild("Stats")
local plrGui = plr:WaitForChild("PlayerGui")
local doorPurchase = plrGui:WaitForChild("DoorPurchase")
local frame = doorPurchase:WaitForChild("Frame")
if cash.Value >= price then
frame.Visible = true
end
end
end)
prompt.Triggered:Connect(function(plr)
local leaderstats = plr:WaitForChild("leaderstats")
local cash = leaderstats:WaitForChild("Stats")
local plrGui = plr:WaitForChild("PlayerGui")
local doorPurchase = plrGui:WaitForChild("DoorPurchase")
local frame = doorPurchase:WaitForChild("Frame")
if cash.Value >= price then
frame.Visible = true
end
end)
This is a server script, place it inside the door part and it will work.
scroll up and there is a script that I wrote for him lol
then wont it make the gui visible to all?