So what im trying to achieve is that if u turn into a morph, it checks if ur either on the ‘hunter’ or the ‘Ghosts’ team. if ur on the Ghosts team the prompts should be disabled, and if ur on the Hunter team it should be enabled.
I’ve tried looping through the players, then fire a remote on which team they are and then enable/disable the prompt through a local script. But what happens right now is that the prompt will stay enabled no matter what, it just doesnt disable for the ghosts team.
Ill provide the code below, hoping someone can help?
The morph (SERVER!) script:
local teams = game:GetService("Teams")
local replicatedstorage = game:GetService("ReplicatedStorage")
local model = script.Parent
local prompt = model.Green_Pot_Big_Prompt.ProximityPrompt
local CatchPrompt = model.Green_Pot_Big_Character.Green_Pot_Big.CatchPrompt
local CatchPromptCreateRemote = replicatedstorage.Remotes.CatchPromptCreateRemote
prompt.Triggered:Connect(function(player)
print("Prompt has been triggered succesfully!") -- to test if its working
local oldCharacter = player.Character
local newCharacter = model.Green_Pot_Big_Character:Clone()
newCharacter.HumanoidRootPart.Anchored = false
newCharacter:SetPrimaryPartCFrame(oldCharacter.PrimaryPart.CFrame)
oldCharacter:Destroy()
newCharacter.Name = player.Name
player.Character = newCharacter
newCharacter.Humanoid.HipHeight = 0.5
newCharacter.Green_Pot_Big.Transparency = 0
newCharacter.Parent = workspace
CatchPrompt.ActionText = "Catch!"
CatchPrompt.RequiresLineOfSight = false
CatchPrompt.HoldDuration = 3
CatchPrompt.Enabled = false
for i,v in ipairs(game:GetService("Players"):GetChildren()) do
if v.Team == teams["Hunters"] then
CatchPromptCreateRemote:FireClient(v, "Hunters")
elseif v.Team == teams["Ghosts"] then
CatchPromptCreateRemote:FireClient(v, "Ghosts")
end
end
end)
The disabling/enabling the prompt (LOCAL!) script
local replicatedstorage = game:GetService("ReplicatedStorage")
local remote = replicatedstorage.Remotes.CatchPromptCreateRemote
local CatchPrompt = script.Parent
remote.OnClientEvent:Connect(function(v)
if v == "Hunters" then
CatchPrompt.Enabled = true
print("Enabled")
if v == "Ghosts" then
CatchPrompt.Enabled = false
print("Disabled")
end
end
end)