Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Ok I dont know where to start I just need some help to start?

How could I make a script that would have a live gui so I'm building a card game where people plays a card and it changes but I want it to be live so it effects both players screen I know this is not a requesting site but I just need some assistance on how to do this

3 comments

0

Do you know any Lua at all? Because if you do not, anything we provide you with would not be able to help you in any way without hand-holding assistance. Try learning a decent amount of Lua first, practicing with GUIs, Parts and player manipulation and syntax. If you want, I can give you a answer on that?

0

I know lua I just need a idea to start

0

Ok.

1 answer

Hierarchy:

  • ServerScriptService
    • CardHandler (Script)
  • ReplicatedStorage
    • Events (Folder)
      • Attack (RemoteEvent)
      • Defend (RemoteEvent)
  • Players
    • Player1
      • PlayerGui
        • CardGui (ScreenGui)
          • ClientHandler (LocalScript)
          • BattleFrame (Frame)
            • ClientAttack (RemoteEvent)
            • ClientDefend (RemoteEvent)
    • Player2 (same as above)

This representation of the explorer should give you everything needed for my suggested setup.


Here's how you do it:

The client will communicate with the server by activating an event in ReplicatedStorage. This event will be binded to some code inside the CardHandler. This will activate the corresponding RemoteEvents in each of the affected players, including the sender.


Example:

Server:

attackEvent.OnServerEvent:connect(function(sender,opponent,data) -- event is defined earlier in the code
	local aEvent = sender.blahblahblah.ClientAttack -- etc, not going to define for my time is short
	aEvent:FireClient(sender,data)
	-- repeat for opponent
end)

Client:

function sendAttack(opponent,data)
	attackEvent:FireServer(opponent,data)
end

local aEvent = script.Parent.blahblah.ClientAttack
aEvent.OnClientEvent:connect(function(data)
	-- code for showing the attack
end)

sendAttack(currentlyBattling,{cards[currentCard]}) -- these parameters are just theories for you to work out

That's the theory of how it should work. I'll leave the specifics to you!


Hope I helped!

~TDP

This discussion is preserved as it was. New answers, comments, and votes are closed.