How to Local = Part, (part that go to serverstorage and workspace sometimes)

local player = game.Players.LocalPlayer
local pat = game:WaitForChild("HalloweenDropper").StuffAtHalloweenLobby.HalloweenDropperDone

	pat.Touched:Connect(function()
	script.Parent.Text = "First Step Done!"
	script.Parent.Parent.nextQust1.Visible = true
	
end)

I wanna local part that go from serverstorage to workspace sometimes

Why do you have this parented inside the game…? Wouldn’t it be better to have it inside the workspace instead?

Use a RemoteEvent, where you can send data over from:

  • Client > Server
  • Server > Client
  • Server > All Clients

It’s pretty simple on how it works, you just need a LocalScript (Which you already have), & a Script where it’d probably belong into ServerScriptService that’ll handle when the RemoteEvent is called

Since RemoteEvents transfer data over from 1 side to the other, we’d want this inside ReplicatedStorage

I’d also consider sanity-checking your Touched Event cause anything can trigger it upon physical contact without the proper conditional checks

-- LocalScript somewhere within StarterPlayerScripts
local RS = game:GetService("ReplicatedStorage")
local Plrs = game:GetService("Players")

local RE = RS:WaitForChild("RemoteEvent")
local Plr = Plrs.LocalPlayer
local Pat = workspace:WaitForChild("HalloweenDropper").StuffAtHalloweenLobby.HalloweenDropperDone

Pat.Touched:Connect(function(Hit)
    local Target = Hit.Parent
    local TouchedPlr = Plrs:GetPlayerFromCharacter(Target)

    if TouchedPlr and TouchedPlr == Plr then
        RE:FireServer() -- This will send a request from the client to the server 
    end
end)
-- Our Script inside ServerScriptService
local RS = game:GetService("ReplicatedStorage")
local RE = RS:WaitForChild("RemoteEvent")

RE.OnServerEvent:Connect(function(Plr) -- The Player that fired on the client will always be the first argument
    -- Insert stuff here to change
end)
1 Like

Its dropper game with maps and i just need to know how to do it, I dont have a lots of remote event idk if i can understand it

RemoteEvents are basically just sending stuff over to the server whenever you call their functions, if you’re wanting to change (From what I presume to be a UIObject of some sort), you’d have to obtain the PlayerGui of the Player that fired the Event in order to change the text (And whatever else you need)

I can’t help you much apart from just giving you the information I know

You sure i dont need to put it in startercharacterscripts?

Depends on your situation, if you parent the LocalScript to StarterCharacterScripts then that script will reset every time your Character loads

If you parent it to StarterPlayerScripts, it’ll only start once until the Player leaves

Well idk if its work, but I think you made me learn something

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.