Script not working properly

my code:


local EggSplat = game.Workspace.EggSplat

local ProximityPrompt = script.Parent

local Player = game:GetService("Players").LocalPlayer

EggSplat.Transparency = 1

ProximityPrompt.Triggered:Connect(function()

if Player.Backpack:FindFirstChild("Egg") then

EggSplat.Transparency = 0

end

end)

egg script:


> local ProximityPrompt = script.Parent.ProximityPrompt
> 
> ProximityPrompt.Triggered:Connect(function()
> 	ProximityPrompt:Destroy()
> 	
> end)

what I am trying to do is that if the egg is picked up, the inventory will detect that if the egg is in there, then the script will make the eggsplat visible. But this doesn’t seem to be working

Is that from a normal script or a local script?

If it’s from a normal script,

you cant access the local player like that.

oh, ok thanks. I will transfer the script into the local script.

Also, it’d be more comfortable for us if you could format this code into the forum. Thank you.
Like this -

print("Hey")

ok did it.

3000-2970=30 dont unblur

Notice that -

If you are adding something to client/ doing somethinf with a script, if you didnt use a remote event/functuon, the server will not recognize that thing on the player from its view, thus - server scripts couldnt detect that thing unless you used a remote to connect client and server.

1 Like