Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I use the MouseButton1Down function in this instance?

Asked by 4 years ago

I'm working on a boss script and I want a gui to pop up saying would you like to join with a decline and accept button. I have the script finished and will list most of it below. Please tell me how I would use it like that.


-- Variables -- local player = game:GetService("Players").LocalPlayer local ReplicatedStorage = game:GetService("ReplicatedStorage") local ServerStorage = game:GetService("ServerStorage") local BossArenas = ServerStorage:WaitForChild("BossArenaMaps") local Status = ReplicatedStorage:WaitForChild("BossInformation").Values.Status local Remaining = ReplicatedStorage:WaitForChild("BossInformation").Values.PlayersRemaining local timeleft = ReplicatedStorage:WaitForChild("BossInformation").Values.Time local TimeLength = ReplicatedStorage.BossInformation.Values.Time -- Time for each game local invalid = "Cannot Find SpawnPoints" -- Start -- while true do repeat wait(1) until game.Players.NumPlayers >= 1 -- UI -- --[[local battlejoin = player.PlayerGui.battlejoin battlejoin.Enabled = true battlejoin.backround.accept.MouseButton1Down:Connect(function() end)--]] Status.Value = "Creating Boss.." wait(.5) Status.Value = "Creating Game.." wait(10) local plrs = {} for i, player in pairs(game.Players:GetPlayers()) do if player then table.insert(plrs,player) -- add players into table end end wait(3) local Arenas = BossArenas:GetChildren() local ArenaChosen = Arenas[math.random(1,#Arenas)] Status.Value = ArenaChosen.Name.." has appeared" local CloneArena = ArenaChosen:Clone() CloneArena.Parent = workspace local battlegui = player.PlayerGui.inbattle battlegui.Enabled = true -- Teleporting Players -- local SpawnPoints = CloneArena:FindFirstChild("SpawnPoints") if not SpawnPoints then print(invalid) end local SpawnPointsAvailable = SpawnPoints:GetChildren() for i, player in pairs(plrs) do if player then character = player.Character if character then -- If theres a character teleport them to arena character:FindFirstChild("HumanoidRootPart").CFrame = SpawnPointsAvailable[1].CFrame table.remove(SpawnPointsAvailable,1) local GameTag = Instance.new("BoolValue") GameTag.Name = "GameTag" GameTag.Parent = player.Character else -- If there is not a character remove them from table if not player then table.remove(plrs,i) end end end end Status.Value("Game Starting...") wait(2) for i = TimeLength,0,-1 do for x, player in pairs(plrs) do if player then character = player.Character if not character then -- the player left the game else if character:FindFirstChild("GameTag") then -- the player is still here print(player.Name.." is still in game") else -- player left game table.remove(plrs.x) print(player.Name.." is removed.") end end else table.remove(plrs,x) print(player.Name.." is removed.") end end timeleft.Value = "Time Left: "..i Remaining.Value = "Players Remaining "..#plrs if #plrs == 1 then -- Plrs Status.Value = "this person is coool" elseif #plrs == 0 then Status.Value = "nobody is alive" elseif i == 0 then timeleft.Value = "TIME IS OUT!!" break end wait(1) end print("game ended") for i, player in pairs(game.Players:GetPlayers()) do character = player.Character if not character then -- ignore em else if character:FindFirstChild("GameTag") then character.GameTag:Destroy() end if player.PlayerGui:FindFirstChild("inbattle") then player.PlayerGui.inbattle.Enabled = false end end player:LoadCharacter() end CloneArena:Destroy() -- game end end
0
A local script can not access ServerStorage BlackOrange3343 2676 — 4y
0
This is not a local script it is a normal script. XxWingKing 96 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

If the gui is on the boss, you could use a BilloardGui and make it so when the click on a button it does whatever needs done. If you want a notification gui on screen you could use a touched event on a part so when they touch it it fires the client to show the gui and then it does the stuff you need.

0
Its suppose to be a gui that pops up. This is not even close to what I'm looking for. XxWingKing 96 — 4y
0
I literally just explained to you how you can make a gui pop up. Maybe if you could explain how the gui pops up. ReallyUnikatni 68 — 4y
Ad

Answer this question