Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

3 comments

0

thanks where do i put the client script?

0

id put it in starterplayer scripts probably

0

where do i put the remote event? and thank you for the help!

1 answer

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.