Hi, just wondering how I make an objective gui similar to undead nations one. I tried alot, but it didn't show anything.
Server Side
game.ReplicatedStorage.ObjectiveChanged.OnServerEvent:Connect(function(A1,A2) print(A1,A2) if A2 == "Objective1A" then for i,v in pairs(game.Players:GetPlayers()) do v.PlayerGui.Objective.Frame.ObjectiveText = "Great, you've gotten out of the forest. Look for a car." v.PlayerGui.Objective.beep:Play() if A2 == "Objective1B" then v.PlayerGui.Objective.Frame.ObjectiveText = "You've found a car, now go drive off somewhere safe." v.PlayerGui.Objective.beep:Play() end end end end)
Objective Changer
local p = script.Parent script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and script.Parent.Completed.Value ~= true then game.ReplicatedStorage.ObjectiveChanged:FireServer("Objective1A") script.Parent.Completed = true end end)
Script In The Part That Changes The Objective
local p = script.Parent script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and script.Parent.Completed.Value == false then--Checks if this is a valid character, and if the completed value is false game.ReplicatedStorage.ObjectiveChanged:FireAllClients("Objective1A")--Fires this to every client, instead of the server handling it, because the server can't access PlayerGui script.Parent.Completed.Value = true--Sets the completed value to true. end end)
LocalScript In Objective Gui
local objective = script.Parent local frame = objective:WaitForChild("Frame") local beep = objective:WaitForChild("beep") game.ReplicatedStorage.ObjectiveChanged.OnClientEvent:Connect(function(A1)--Sets up connection to the OnClientEvent, the A1 variable is what type of objective it is if A1 == "Objective1A" then--Does a check for what objective it is frame.ObjectiveText.Text = "Great, you've gotten out of the forest. Look for a car."--Change's text beep:Play()--Play's beep elseif A1 == "Objective1B" then frame.ObjectiveText.Text = "You've found a car, now go drive off somewhere safe."--Change's text beep:Play()--Play's beep end end)
I read through your scripts and found something that may be the cause of this not working.
In the objective changer script on line seven, you set what I infer is a BoolValue to true, but don't use '.Value'.
So what you would do:
local p = script.Parent script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and script.Parent.Completed.Value ~= true then game.ReplicatedStorage.ObjectiveChanged:FireServer("Objective1A") script.Parent.Completed.Value = true --instead of script.Parent.Completed = true end end)
If this is not the cause, please comment so that I can look into it further.
Hope this works for you! Merry Christmas. :)