Your LocalScript is fine, it’s the Script inside the head that needs updating.
I’ve explained how to update your Script here: Cant make my text invisible with a script - #16 by SiebeYolo
Your LocalScript is fine, it’s the Script inside the head that needs updating.
I’ve explained how to update your Script here: Cant make my text invisible with a script - #16 by SiebeYolo
I added this to my regular script in my model but its not working lines of code:
Server script (“Script”): sending Event
Client script (“LocalScript”): receiving Event
Could you add what you meant to my script that i already have? thank you
I quickly outlined what purpose each of your two scripts had. Your Script inside the Head needs to send the RemoteEvent, your LocalScript needs to receive the RemoteEvent.
You need to update your Script inside the Head to properly fire your RemoteEvent, instead of changing the StarterGui, which does not do anything regardless.
Im really confused can you give me the updates script and where i need to put it? im so sorry please help me with this one
hey, can u send me the full script?
-- Wait 5 seconds after the game starts
wait(5)
-- Get the Head model
local head = script.Parent
-- TweenService for smooth animation
local TweenService = game:GetService("TweenService")
-- TweenInfo for reuse
local tweenInfo = TweenInfo.new(1)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage.SetRedLightGreenLight
local function rotatePart(part)
-- Store the original CFrame
local originalCFrame = part.CFrame
Event:FireAllClients()
-- Create and play the tween to rotate 180 degrees
local goal = {CFrame = originalCFrame * CFrame.Angles(0, math.rad(180), 0)}
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
-- Wait for the tween to complete
tween.Completed:Wait()
-- Wait 4 seconds
wait(4)
-- Create and play the tween to rotate back to the original position
local reverseGoal = {CFrame = originalCFrame}
local reverseTween = TweenService:Create(part, tweenInfo, reverseGoal)
reverseTween:Play()
end
-- Iterate through all the parts inside the Head model
for _, part in pairs(head:GetChildren()) do
if part:IsA("BasePart") then
rotatePart(part)
end
end
I’ve just replaced the line that used to be the StarterGui line, but there’s multiple issues with your code.
Ok so now that i used that exact script it didnt work, the green text doesnt become invisible, did i have to add a Localscript too? And what did i have to write there i literally forgot im sorry.
I’ll compile everything we’ve did so far in this thread.
Script:
-- Wait 5 seconds after the game starts
wait(5)
-- Get the Head model
local head = script.Parent
-- TweenService for smooth animation
local TweenService = game:GetService("TweenService")
-- TweenInfo for reuse
local tweenInfo = TweenInfo.new(1)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage.SetRedLightGreenLight
local function rotatePart(part)
-- Store the original CFrame
local originalCFrame = part.CFrame
Event:FireAllClients()
-- Create and play the tween to rotate 180 degrees
local goal = {CFrame = originalCFrame * CFrame.Angles(0, math.rad(180), 0)}
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
-- Wait for the tween to complete
tween.Completed:Wait()
-- Wait 4 seconds
wait(4)
-- Create and play the tween to rotate back to the original position
local reverseGoal = {CFrame = originalCFrame}
local reverseTween = TweenService:Create(part, tweenInfo, reverseGoal)
reverseTween:Play()
end
-- Iterate through all the parts inside the Head model
for _, part in pairs(head:GetChildren()) do
if part:IsA("BasePart") then
rotatePart(part)
end
end
LocalScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage.SetRedLightGreenLight
local ScreenGui = script.Parent
local GreenLight = ScreenGui.GreenLight
local RedLight = ScreenGui.RedLight
Event.OnClientEvent:Connect(function()
GreenLight.Visible = false
end)
Now, these scripts are very basic, so they’ll only disable your Green Light text once. In order to make it work better, you’ll have to use different parameters. If you need help with that, let me know.