local ProximityPromptService = game:GetService("ProximityPromptService")
local Rep = game:GetService("ReplicatedStorage")
local Events = Rep:WaitForChild("Events")
local Claim = Events.Claim
-- Detect when prompt is triggered
local function onPromptTriggered(promptObject, player)
end
How would I do this with a remote function
Basically Have the client request a free tycoon for owner ship, the server checks to see if the client already has a tycoon and if they don’t returns ownership to the client
You add a string value named owner which will have the value name of the owner then if another person came to claim it the server will check if there is a string value if there is then return end
You could just simply Disable the Prompt when a player first triggers it on the server, or you can use ObjectValues which check if the Player Object is equal to the Original Owner who first activated the prompt
Try setting the require line of sight to false
Also don’t use local script for that as local script only works when parented to starter player or starter character or starter gui
Reference the LocalScript inside StarterPlayerScripts, then you could either use a RemoteEvent or RemoteFunction to handle this (Preferably I’d do RemoteEvent to make it easier)
local ProximityPromptService = game:GetService("ProximityPromptService")
local Rep = game:GetService("ReplicatedStorage")
local Events = Rep:WaitForChild("Events")
local Claim = Events.Claim
-- Detect when prompt is triggered
local function onPromptTriggered(promptObject, player)
Claim:FireServer()
end
And on your server side:
local Rep = game:GetService("ReplicatedStorage")
local Events = Rep:WaitForChild("Events")
local Claim = Events.Claim
local CurrentOwner
Claim.OnServerEvent:Connect(function(Player)
print(CurrentOwner)
if CurrentOwner == nil then
CurrentOwner = Player
--Do your tycoon stuff here, aka disabling the prompt on the server side
end
end)