-
What do you want to achieve? For Sky to change every time i Touch The block
-
What is the issue? Client code isn’t running
-
What solutions have you tried so far? Tried looking dev hub, Developer Forum Posts and else
https://streamable.com/fgh7mg
Server:
local function onTouch(hit)
local Humanoid = hit.Parent:FindFirstChild("Humanoid")
if Humanoid then
print("Fire Client Sky Remote")
script.Parent.SkyLavaRemote:FireClient(game.Players:GetPlayerFromCharacter(Humanoid.Parent))
end
end
local function onSnowTouch(hit)
local Humanoid = hit.Parent:FindFirstChild("Humanoid")
if Humanoid then
print("Fire Client Sky Snow Remote")
script.Parent.SkySnowRemote:FireClient(game.Players:GetPlayerFromCharacter(Humanoid.Parent))
end
end
script.Parent.SnowSkyChange.Touched:Connect(onSnowTouch)
script.Parent.LavaSkyChange.Touched:Connect(onTouch)
Client:
local Lighting = game.Lighting
script.Parent.SkyLavaRemote.OnClientEvent:Connect(function(Player)
if Player then
print("Fired Lava Event In Client")
if Lighting:FindFirstChild("Sky") then
Lighting.Sky:Destroy()
local Lava_Sky_Clone = script.Parent.LavaSkyChange.Sky:Clone()
Lava_Sky_Clone.Parent = Lighting
end
end
end)
script.Parent.SkySnowRemote.OnClientEvent:Connect(function(player)
if player then
print("Fired Snow Event in Client")
if Lighting:FindFirstChild("Sky") then
Lighting.Sky:Destroy()
local Snow_Sky_Clone = script.Parent.SnowSkyChange.Sky:Clone()
Snow_Sky_Clone.Parent = Lighting
end
end
end)