So simple medical system, proximity prompt trigger, server fires event, localscript should receive it and show a GUI, not sure why it’s not working.(No errors)
Serverscript:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = Instance.new("RemoteEvent")
event.Name = "ShowMedicalIssues"
event.Parent = ReplicatedStorage
local issues = {
"Heavy Bleeding",
"Light Bleeding",
"Major Pain",
"Light Pain"
}
script.Parent.Parent.Help.Triggered:Connect(function(player)
-- Generate issues
local numIssues = math.random(1,5)
event:FireClient(player, numIssues)
for i = 1, numIssues do
local symptom = issues[math.random(1,#issues)]
event:FireClient(player, symptom, i)
end
end)
LocalScript:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("ShowMedicalIssues")
local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local medGui = playerGui:WaitForChild("MedGui")
event.OnClientEvent:Connect(function(numIssues)
-- Got number of issues
print("Showing", numIssues, "issues")
medGui.Issues.Visible = true
end)
event.OnClientEvent:Connect(function(symptom, issueNumber)
-- Got symptom for individual issue
local issue = medGui.Issues:WaitForChild("Issue"..issueNumber)
issue.Visible = true
issue.Text = symptom
print("Set " .. issueNumber .. " to " .. symptom)
end)
RemoteEvent gets created by the serverscript.