You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I am trying to remove the wall after players Buy it
something like this
Player Activates triggers Proximity Prompt
a Gui pops up
if player clicks Yes it removes the Wall
-
What is the issue? Include screenshots / videos if possible!
Well, Server doesn’t know which wall player is trying to buy/remove so I can’t check the price of wall
local ProximityService = game:GetService("ProximityPromptService")
local Remotes = game:GetService("ReplicatedStorage"):WaitForChild("Remotes")
local Module = require(game:GetService("ReplicatedStorage"):WaitForChild("Zone"))
local Zones = game:GetService("Workspace"):WaitForChild("Zones")
local zone = script.Parent
local TextLabel = zone:WaitForChild("SurfaceGui"):WaitForChild("TextLabel")
for i, v in pairs(Zones:GetChildren())do
print(v)
v:WaitForChild("SurfaceGui"):WaitForChild("TextLabel").Text = Module[v.Name]["Price"]
end
ProximityService.PromptTriggered:Connect(function(a,player) -- fire Client to show gui
warn("Player Triggered the Prompt")
Remotes.ZoneBuy:FireClient(player)
end)
Remotes.ZoneBuyCheck.OnServerInvoke = function(player,b,c) --Invoke server to Check player's money and wall's price
print("YesButtonSignalTaken")
for i, v in pairs(Module) do
print(v)
print(i)
end
end
-- this is the local script to Invoke Server after player clicks yes button
local ZoneRemote = game:GetService("ReplicatedStorage"):WaitForChild("Remotes"):WaitForChild("ZoneBuy")
local Gui = script.Parent.Parent.Parent
local Remotes = game:GetService("ReplicatedStorage"):WaitForChild("Remotes")
local ZoneChecker = Remotes:WaitForChild("ZoneBuyCheck")
local Holder = script.Parent
local YesButton = Holder:WaitForChild("YesButton")
local NoButton = Holder:WaitForChild("NoButton")
ZoneRemote.OnClientEvent:Connect(function(a,b)
Gui.Enabled = true
end)
YesButton.Activated:Connect(function(a,b,c,d)
local Mentoriana = ZoneChecker:InvokeServer()
end)
NoButton.Activated:Connect(function()
Gui.Enabled = false
end)
like I said issue is server doesn’t know which zone player tried to buy so I can’t do Player’s money -Zone’s price or I can’t remove that certain wall let’s say player tries to buy1, but server doesn’t know which zone player tries to buy