LocalScript and ReplicatedStorage help

Im trying to make an Easter event for my friend’s group where you have to find all the eggs after recieving a quest.

How do I make my eggs disappear on joining the game and appear when gaining the quest.

----------SCRIPT----------

local Egg = script.Parent

local ForceField = script.Parent.ForceField

game.ReplicatedStorage.QuestRecieve.OnClientEvent:Connect(function() – recieving quest event

Egg.Transparency = 0

ForceField.Transparency = 0

end)

script.Parent.ClickDetector.MouseClick:Connect(function() – clicking on egg supposed to make egg disappear and fire the key event

game.ReplicatedStorage.Key:FireClient()

Egg.Transparency = 1

ForceField.Transparency = 1

end)

There are no current errors but it isn’t working.
Please explain what I have done wrong.

1 Like

Does the event fire?
Try adding print() then see if the event goes through

When you are Firing The Client, you Need to specificy For Which Player You Are Firing the Remote To.

script.Parent.ClickDetector.MouseClick:Connect(function() – clicking on egg supposed to make egg disappear and fire the key event
   game.ReplicatedStorage.Key:FireClient() -- Here You Need to Specify The Player in the Brackets
   Egg.Transparency = 1
   ForceField.Transparency = 1
end)

Sooo Your New Script should Have

script.Parent.ClickDetector.MouseClick:Connect(function(Player) – clicking on egg supposed to make egg disappear and fire the key event
   game.ReplicatedStorage.Key:FireClient(Player) -- We Fire the Client to The Player
   Egg.Transparency = 1
   ForceField.Transparency = 1
end)

(Also I Wrote the Above Answer Thinking you Have Correctly Put your Script in LocalScript’s And ServerScript’s Respectively)

Im trying to fire the local player so that when the quest is recieved only the player can see the block that claimed the quest. This script is in a local script btw

If you want only that player to see it, there are a couple of ways,

One of them is to fire that client from the server

One of them is to do code on the client[local script, for that thing - > only that player would be able to see it]

Hello buddy,

Local-Scripts do not work unless they are in the following

  • A Player’s Backpack [ex. TOOL]
  • A Player’s character
  • A Player’s PlayerGui
  • A Player’s PlayerScripts
  • The ReplicatedFirst service

ROBLOX Local-Script Link

If your local-script is not inside (a ‘child’ of) any of the above - it won’t run.

As for making everything disappear until your Player get’s a quest, try using “CollectionService” :AddTag( Object , TagName )

I hope I helped, shall you have further questions, hit us up (: