I have button and when I touch it I want the thing to happen to one client so I use a remote event and fire a Client function and then I have a local script inside of StarterGui to take it up but when I touch the button nothing happens, output doesn't print anything and it doesn't show any errors aswell. I'm gonna give you all scripts that are involved in this and hope you find a solution thank you.
--SERVERSCRIPT, WORKSPACE
local playerEvent = game:GetService("ReplicatedStorage").Player
local function onTouched(player)
if player:FindFirstChild("Humanoid") then
local playerObj = player:GetPlayerFromCharacter(player.Parent)
playerEvent:FireClient(playerObj)
end
end
script.Parent.Touched:Connect(onTouched)
2nd script
-- LOCAL SCRIPT, STARTERGUI
local playerEvent = game:GetService("ReplicatedStorage").Player
local playerEventTwo = game:GetService("ReplicatedStorage").Player2
playerEvent.OnClientEvent:Connect(function()
local activatedParts = game.Workspace["Very Easy"].ActivatedParts:GetChildren()
for i,v in pairs(activatedParts) do
v.CanCollide = true
v.Transparency = 0
end
game.Workspace["Very Easy"].Button1.Color = Color3.fromRGB(255, 0, 0)
end)
playerEventTwo.OnClientEvent:Connect(function()
local activatedParts = game.Workspace["Very Easy"].ActivatedParts2:GetChildren()
for i,v in pairs(activatedParts) do
v.CanCollide = true
v.Transparency = 0
end
game.Workspace["Very Easy"].Button2.Color = Color3.fromRGB(255, 0, 0)
end)

1 comment
Thanks!