Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

i am trying to make my iron man helmet open and close can somebody help?

Asked by 3 years ago

i'm trying to make my game and my script is not working i'm trying to make it so it makes the mask invisible as a text button and also i want other people to see it so i'm using a server script code is here: script.parent.MouseButton1Click:Connect(function() game.Workspace.Helmet.Mask.Transparency = 0 end

0
thanks where do i put the client script? go3jack 1 — 3y
0
id put it in starterplayer scripts probably CaioAlpaca 342 — 3y
0
where do i put the remote event? and thank you for the help! go3jack 1 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago

You cant use mouseButton1Click on the server.

Do the mouse click on the client, then fire a remote event to the server, then make a function for setting the Helmet transparency to 0 (or 1)

Example

client

local event = path_to_your_event

button.MouseButton1Down:Connect(function()
    --could add a simple debounce here
    event:FireServer(1) --we are going to fire 1 as the argument
end)    

server

local event = path_to_your_event
local helmet = path_to_helmet

 --we are going to make sure given transparency is a number so we add the :number 
local function setHelmetTransparency(Player, givenTransparency: number)
    --player is the player that fired the event
    --givenTransparency is the number we passed as an argument on the client

    helmet.Transparency = givenTransparency
end

event.OnServerEvent:Connect(setHelmetTransparency) --this is how we receive remote events on the server

Ad

Answer this question